mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 10:31:46 +09:00
powerpc/vdso: Refactor CFLAGS for CVDSO build
[ Upstream commit a6b67eb09963af29991625862cbb4f56b85954ed ] 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> Stable-dep-of: d677ce521334 ("powerpc/vdso: Drop -mstack-protector-guard flags in 32-bit files with clang") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
e4ccf8ec27
commit
2b015f0652
@@ -10,28 +10,11 @@ obj-vdso64 = sigtramp64-64.o gettimeofday-64.o datapage-64.o cacheflush-64.o not
|
|||||||
|
|
||||||
ifneq ($(c-gettimeofday-y),)
|
ifneq ($(c-gettimeofday-y),)
|
||||||
CFLAGS_vgettimeofday-32.o += -include $(c-gettimeofday-y)
|
CFLAGS_vgettimeofday-32.o += -include $(c-gettimeofday-y)
|
||||||
CFLAGS_vgettimeofday-32.o += $(DISABLE_LATENT_ENTROPY_PLUGIN)
|
|
||||||
CFLAGS_vgettimeofday-32.o += $(call cc-option, -fno-stack-protector)
|
|
||||||
CFLAGS_vgettimeofday-32.o += -DDISABLE_BRANCH_PROFILING
|
|
||||||
CFLAGS_vgettimeofday-32.o += -ffreestanding -fasynchronous-unwind-tables
|
|
||||||
CFLAGS_REMOVE_vgettimeofday-32.o = $(CC_FLAGS_FTRACE)
|
|
||||||
CFLAGS_REMOVE_vgettimeofday-32.o += -mcmodel=medium -mabi=elfv1 -mabi=elfv2 -mcall-aixdesc
|
|
||||||
# This flag is supported by clang for 64-bit but not 32-bit so it will cause
|
|
||||||
# an unused command line flag warning for this file.
|
|
||||||
ifdef CONFIG_CC_IS_CLANG
|
|
||||||
CFLAGS_REMOVE_vgettimeofday-32.o += -fno-stack-clash-protection
|
|
||||||
endif
|
|
||||||
CFLAGS_vgettimeofday-64.o += -include $(c-gettimeofday-y)
|
|
||||||
CFLAGS_vgettimeofday-64.o += $(DISABLE_LATENT_ENTROPY_PLUGIN)
|
|
||||||
CFLAGS_vgettimeofday-64.o += $(call cc-option, -fno-stack-protector)
|
|
||||||
CFLAGS_vgettimeofday-64.o += -DDISABLE_BRANCH_PROFILING
|
|
||||||
CFLAGS_vgettimeofday-64.o += -ffreestanding -fasynchronous-unwind-tables
|
|
||||||
CFLAGS_REMOVE_vgettimeofday-64.o = $(CC_FLAGS_FTRACE)
|
|
||||||
# Go prior to 1.16.x assumes r30 is not clobbered by any VDSO code. That used to be true
|
# Go prior to 1.16.x assumes r30 is not clobbered by any VDSO code. That used to be true
|
||||||
# by accident when the VDSO was hand-written asm code, but may not be now that the VDSO is
|
# by accident when the VDSO was hand-written asm code, but may not be now that the VDSO is
|
||||||
# compiler generated. To avoid breaking Go tell GCC not to use r30. Impact on code
|
# compiler generated. To avoid breaking Go tell GCC not to use r30. Impact on code
|
||||||
# generation is minimal, it will just use r29 instead.
|
# generation is minimal, it will just use r29 instead.
|
||||||
CFLAGS_vgettimeofday-64.o += $(call cc-option, -ffixed-r30)
|
CFLAGS_vgettimeofday-64.o += -include $(c-gettimeofday-y) $(call cc-option, -ffixed-r30)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Build rules
|
# Build rules
|
||||||
@@ -53,12 +36,23 @@ UBSAN_SANITIZE := n
|
|||||||
KASAN_SANITIZE := n
|
KASAN_SANITIZE := n
|
||||||
|
|
||||||
ccflags-y := -fno-common -fno-builtin
|
ccflags-y := -fno-common -fno-builtin
|
||||||
|
ccflags-y += $(DISABLE_LATENT_ENTROPY_PLUGIN)
|
||||||
|
ccflags-y += $(call cc-option, -fno-stack-protector)
|
||||||
|
ccflags-y += -DDISABLE_BRANCH_PROFILING
|
||||||
|
ccflags-y += -ffreestanding -fasynchronous-unwind-tables
|
||||||
|
ccflags-remove-y := $(CC_FLAGS_FTRACE)
|
||||||
ldflags-y := -Wl,--hash-style=both -nostdlib -shared -z noexecstack $(CLANG_FLAGS)
|
ldflags-y := -Wl,--hash-style=both -nostdlib -shared -z noexecstack $(CLANG_FLAGS)
|
||||||
ldflags-$(CONFIG_LD_IS_LLD) += $(call cc-option,--ld-path=$(LD),-fuse-ld=lld)
|
ldflags-$(CONFIG_LD_IS_LLD) += $(call cc-option,--ld-path=$(LD),-fuse-ld=lld)
|
||||||
# Filter flags that clang will warn are unused for linking
|
# Filter flags that clang will warn are unused for linking
|
||||||
ldflags-y += $(filter-out $(CC_FLAGS_FTRACE) -Wa$(comma)%, $(KBUILD_CFLAGS))
|
ldflags-y += $(filter-out $(CC_FLAGS_FTRACE) -Wa$(comma)%, $(KBUILD_CFLAGS))
|
||||||
|
|
||||||
CC32FLAGS := -m32
|
CC32FLAGS := -m32
|
||||||
|
CC32FLAGSREMOVE := -mcmodel=medium -mabi=elfv1 -mabi=elfv2 -mcall-aixdesc
|
||||||
|
# This flag is supported by clang for 64-bit but not 32-bit so it will cause
|
||||||
|
# an unused command line flag warning for this file.
|
||||||
|
ifdef CONFIG_CC_IS_CLANG
|
||||||
|
CC32FLAGSREMOVE += -fno-stack-clash-protection
|
||||||
|
endif
|
||||||
LD32FLAGS := -Wl,-soname=linux-vdso32.so.1
|
LD32FLAGS := -Wl,-soname=linux-vdso32.so.1
|
||||||
AS32FLAGS := -D__VDSO32__
|
AS32FLAGS := -D__VDSO32__
|
||||||
|
|
||||||
@@ -105,7 +99,7 @@ quiet_cmd_vdso32ld_and_check = VDSO32L $@
|
|||||||
quiet_cmd_vdso32as = VDSO32A $@
|
quiet_cmd_vdso32as = VDSO32A $@
|
||||||
cmd_vdso32as = $(VDSOCC) $(a_flags) $(CC32FLAGS) $(AS32FLAGS) -c -o $@ $<
|
cmd_vdso32as = $(VDSOCC) $(a_flags) $(CC32FLAGS) $(AS32FLAGS) -c -o $@ $<
|
||||||
quiet_cmd_vdso32cc = VDSO32C $@
|
quiet_cmd_vdso32cc = VDSO32C $@
|
||||||
cmd_vdso32cc = $(VDSOCC) $(c_flags) $(CC32FLAGS) -c -o $@ $<
|
cmd_vdso32cc = $(VDSOCC) $(filter-out $(CC32FLAGSREMOVE), $(c_flags)) $(CC32FLAGS) -c -o $@ $<
|
||||||
|
|
||||||
quiet_cmd_vdso64ld_and_check = VDSO64L $@
|
quiet_cmd_vdso64ld_and_check = VDSO64L $@
|
||||||
cmd_vdso64ld_and_check = $(VDSOCC) $(ldflags-y) $(LD64FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^); $(cmd_vdso_check)
|
cmd_vdso64ld_and_check = $(VDSOCC) $(ldflags-y) $(LD64FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^); $(cmd_vdso_check)
|
||||||
|
|||||||
Reference in New Issue
Block a user