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: Refactor CFLAGS for CVDSO build

In order to avoid two much duplication when we add new VDSO
functionnalities in C like getrandom, refactor common CFLAGS.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Acked-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>

authored by

Christophe Leroy and committed by
Jason A. Donenfeld
a6b67eb0 b163596a

+13 -19
+13 -19
arch/powerpc/kernel/vdso/Makefile
··· 10 10 11 11 ifneq ($(c-gettimeofday-y),) 12 12 CFLAGS_vgettimeofday-32.o += -include $(c-gettimeofday-y) 13 - CFLAGS_vgettimeofday-32.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) 14 - CFLAGS_vgettimeofday-32.o += $(call cc-option, -fno-stack-protector) 15 - CFLAGS_vgettimeofday-32.o += -DDISABLE_BRANCH_PROFILING 16 - CFLAGS_vgettimeofday-32.o += -ffreestanding -fasynchronous-unwind-tables 17 - CFLAGS_REMOVE_vgettimeofday-32.o = $(CC_FLAGS_FTRACE) 18 - CFLAGS_REMOVE_vgettimeofday-32.o += -mcmodel=medium -mabi=elfv1 -mabi=elfv2 -mcall-aixdesc 19 - # This flag is supported by clang for 64-bit but not 32-bit so it will cause 20 - # an unused command line flag warning for this file. 21 - ifdef CONFIG_CC_IS_CLANG 22 - CFLAGS_REMOVE_vgettimeofday-32.o += -fno-stack-clash-protection 23 - endif 24 - CFLAGS_vgettimeofday-64.o += -include $(c-gettimeofday-y) 25 - CFLAGS_vgettimeofday-64.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) 26 - CFLAGS_vgettimeofday-64.o += $(call cc-option, -fno-stack-protector) 27 - CFLAGS_vgettimeofday-64.o += -DDISABLE_BRANCH_PROFILING 28 - CFLAGS_vgettimeofday-64.o += -ffreestanding -fasynchronous-unwind-tables 29 - CFLAGS_REMOVE_vgettimeofday-64.o = $(CC_FLAGS_FTRACE) 30 13 # Go prior to 1.16.x assumes r30 is not clobbered by any VDSO code. That used to be true 31 14 # by accident when the VDSO was hand-written asm code, but may not be now that the VDSO is 32 15 # compiler generated. To avoid breaking Go tell GCC not to use r30. Impact on code 33 16 # generation is minimal, it will just use r29 instead. 34 - CFLAGS_vgettimeofday-64.o += $(call cc-option, -ffixed-r30) 17 + CFLAGS_vgettimeofday-64.o += -include $(c-gettimeofday-y) $(call cc-option, -ffixed-r30) 35 18 endif 36 19 37 20 # Build rules ··· 32 49 obj-vdso64 := $(addprefix $(obj)/, $(obj-vdso64)) 33 50 34 51 ccflags-y := -fno-common -fno-builtin 52 + ccflags-y += $(DISABLE_LATENT_ENTROPY_PLUGIN) 53 + ccflags-y += $(call cc-option, -fno-stack-protector) 54 + ccflags-y += -DDISABLE_BRANCH_PROFILING 55 + ccflags-y += -ffreestanding -fasynchronous-unwind-tables 56 + ccflags-remove-y := $(CC_FLAGS_FTRACE) 35 57 ldflags-y := -Wl,--hash-style=both -nostdlib -shared -z noexecstack $(CLANG_FLAGS) 36 58 ldflags-$(CONFIG_LD_IS_LLD) += $(call cc-option,--ld-path=$(LD),-fuse-ld=lld) 37 59 ldflags-$(CONFIG_LD_ORPHAN_WARN) += -Wl,--orphan-handling=$(CONFIG_LD_ORPHAN_WARN_LEVEL) ··· 45 57 ldflags-y += $(filter-out $(CC_AUTO_VAR_INIT_ZERO_ENABLER) $(CC_FLAGS_FTRACE) -Wa$(comma)%, $(KBUILD_CFLAGS)) 46 58 47 59 CC32FLAGS := -m32 60 + CC32FLAGSREMOVE := -mcmodel=medium -mabi=elfv1 -mabi=elfv2 -mcall-aixdesc 61 + # This flag is supported by clang for 64-bit but not 32-bit so it will cause 62 + # an unused command line flag warning for this file. 63 + ifdef CONFIG_CC_IS_CLANG 64 + CC32FLAGSREMOVE += -fno-stack-clash-protection 65 + endif 48 66 LD32FLAGS := -Wl,-soname=linux-vdso32.so.1 49 67 AS32FLAGS := -D__VDSO32__ 50 68 ··· 99 105 quiet_cmd_vdso32as = VDSO32A $@ 100 106 cmd_vdso32as = $(VDSOCC) $(a_flags) $(CC32FLAGS) $(AS32FLAGS) -c -o $@ $< 101 107 quiet_cmd_vdso32cc = VDSO32C $@ 102 - cmd_vdso32cc = $(VDSOCC) $(c_flags) $(CC32FLAGS) -c -o $@ $< 108 + cmd_vdso32cc = $(VDSOCC) $(filter-out $(CC32FLAGSREMOVE), $(c_flags)) $(CC32FLAGS) -c -o $@ $< 103 109 104 110 quiet_cmd_vdso64ld_and_check = VDSO64L $@ 105 111 cmd_vdso64ld_and_check = $(VDSOCC) $(ldflags-y) $(LD64FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^); $(cmd_vdso_check)