powerpc/vdso: Drop -mstack-protector-guard flags in 32-bit files with clang
authorNathan Chancellor <nathan@kernel.org>
Wed, 30 Oct 2024 18:41:37 +0000 (11:41 -0700)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 4 Nov 2024 06:03:10 +0000 (17:03 +1100)
commitd677ce521334d8f1f327cafc8b1b7854b0833158
tree510f0d4a566d5ffd2ccc92d2f8df9ae6df6b2b04
parentd243b62b7bd3d5314382d3b54e4992226245e936
powerpc/vdso: Drop -mstack-protector-guard flags in 32-bit files with clang

Under certain conditions, the 64-bit '-mstack-protector-guard' flags may
end up in the 32-bit vDSO flags, resulting in build failures due to the
structure of clang's argument parsing of the stack protector options,
which validates the arguments of the stack protector guard flags
unconditionally in the frontend, choking on the 64-bit values when
targeting 32-bit:

  clang: error: invalid value 'r13' in 'mstack-protector-guard-reg=', expected one of: r2
  clang: error: invalid value 'r13' in 'mstack-protector-guard-reg=', expected one of: r2
  make[3]: *** [arch/powerpc/kernel/vdso/Makefile:85: arch/powerpc/kernel/vdso/vgettimeofday-32.o] Error 1
  make[3]: *** [arch/powerpc/kernel/vdso/Makefile:87: arch/powerpc/kernel/vdso/vgetrandom-32.o] Error 1

Remove these flags by adding them to the CC32FLAGSREMOVE variable, which
already handles situations similar to this. Additionally, reformat and
align a comment better for the expanding CONFIG_CC_IS_CLANG block.

Cc: stable@vger.kernel.org # v6.1+
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://patch.msgid.link/20241030-powerpc-vdso-drop-stackp-flags-clang-v1-1-d95e7376d29c@kernel.org
arch/powerpc/kernel/vdso/Makefile