Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

authored by

Nathan Chancellor and committed by
Michael Ellerman
d677ce52 d243b62b

+6 -2
+6 -2
arch/powerpc/kernel/vdso/Makefile
··· 54 54 55 55 CC32FLAGS := -m32 56 56 CC32FLAGSREMOVE := -mcmodel=medium -mabi=elfv1 -mabi=elfv2 -mcall-aixdesc 57 - # This flag is supported by clang for 64-bit but not 32-bit so it will cause 58 - # an unused command line flag warning for this file. 59 57 ifdef CONFIG_CC_IS_CLANG 58 + # This flag is supported by clang for 64-bit but not 32-bit so it will cause 59 + # an unused command line flag warning for this file. 60 60 CC32FLAGSREMOVE += -fno-stack-clash-protection 61 + # -mstack-protector-guard values from the 64-bit build are not valid for the 62 + # 32-bit one. clang validates the values passed to these arguments during 63 + # parsing, even when -fno-stack-protector is passed afterwards. 64 + CC32FLAGSREMOVE += -mstack-protector-guard% 61 65 endif 62 66 LD32FLAGS := -Wl,-soname=linux-vdso32.so.1 63 67 AS32FLAGS := -D__VDSO32__