mirror of
https://github.com/torvalds/linux.git
synced 2026-05-31 10:33:41 +02:00
- Remove and simplify a bunch of cc-option and compiler version checks
in the build machinery now that the minimal version of both compilers supports them -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEzv7L6UO9uDPlPSfHEsHwGGHeVUoFAmjWY9YACgkQEsHwGGHe VUqfFg//Xurr+1VmGxgu7lwKodwsJyUOHmbN35j0h2kpH/viNe2CG5MYGjaIH5MU VcMN3WHCydXHPsU2ohVqYeBlSL9fmQ4nUeoh/vfekwwPTbbM4+WxVjAdoTLp8iT9 9ZR+PLCKirihFp4EQSMkOIq9HeV3F1g3syrhuMRpkUQ550P/fqo2W066cHpevKqZ UUmd+hO00VEwSWDN7IGs2QFCQfQ+eXPfHm0Or81j9v8flsQjraTqJzWvnsZaHvlm zotcblPQub/MOSOBpIkChNyK+ZW7hCXtqjavo+R7MoEkq2mRimlsQZc3Cv1v7+D/ ebMEB1EIwzz2S3OctmfDzKc/zmLEybgV7zESzxJ38JA60YfRqE7jQr2ssZTJJmBg Hh8W1O9RXhRW+XGIWL/SwI7JrUClO3cfc/zObEyMfqmiAtXPqjLgUo4Za0+yqS46 uGZ2608L5YI9bhCOhL0p0j9U9i6EjB+NjE79c//bFYbx8G01QotgKnKyiPLwgQxo 1/LVfZ4eWf9YpNCdynBl29k0Yso+tvku4bAyuvrGgua3mo9myfUmWbWu5ISn7rxK esnGmBcfCKdMymz89kIk5jl0l3FMHgkxwwH5o+2puvygMB76l88Lk9oP1muSV5pa oLcLp9tnNdmElqjWfHCz9QdOaPrgP6S+l/Ce1yoZawo+1ALq5Rg= =7uXL -----END PGP SIGNATURE----- Merge tag 'x86_build_for_v6.18_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip Pull x86 build updates from Borislav Petkov: - Remove and simplify a bunch of cc-option and compiler version checks in the build machinery now that the minimal version of both compilers supports them * tag 'x86_build_for_v6.18_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/Kconfig: Clean up LLVM version checks in IBT configurations x86/build: Remove cc-option from -mskip-rax-setup x86/build: Remove cc-option from -mno-fp-ret-in-387 x86/build: Clean up stack alignment flags in CC_FLAGS_FPU x86/build: Remove cc-option from stack alignment flags x86/build: Remove cc-option for GCC retpoline flags
This commit is contained in:
commit
163d9c6b33
|
|
@ -1734,11 +1734,7 @@ config X86_UMIP
|
|||
config CC_HAS_IBT
|
||||
# GCC >= 9 and binutils >= 2.29
|
||||
# Retpoline check to work around https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93654
|
||||
# Clang/LLVM >= 14
|
||||
# https://github.com/llvm/llvm-project/commit/e0b89df2e0f0130881bf6c39bf31d7f6aac00e0f
|
||||
# https://github.com/llvm/llvm-project/commit/dfcf69770bc522b9e411c66454934a37c1f35332
|
||||
def_bool ((CC_IS_GCC && $(cc-option, -fcf-protection=branch -mindirect-branch-register)) || \
|
||||
(CC_IS_CLANG && CLANG_VERSION >= 140000)) && \
|
||||
def_bool ((CC_IS_GCC && $(cc-option, -fcf-protection=branch -mindirect-branch-register)) || CC_IS_CLANG) && \
|
||||
$(as-instr,endbr64)
|
||||
|
||||
config X86_CET
|
||||
|
|
@ -1750,8 +1746,6 @@ config X86_KERNEL_IBT
|
|||
prompt "Indirect Branch Tracking"
|
||||
def_bool y
|
||||
depends on X86_64 && CC_HAS_IBT && HAVE_OBJTOOL
|
||||
# https://github.com/llvm/llvm-project/commit/9d7001eba9c4cb311e03cd8cdc231f9e579f2d0f
|
||||
depends on !LD_IS_LLD || LLD_VERSION >= 140000
|
||||
select OBJTOOL
|
||||
select X86_CET
|
||||
help
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ else
|
|||
endif
|
||||
|
||||
ifdef CONFIG_CC_IS_GCC
|
||||
RETPOLINE_CFLAGS := $(call cc-option,-mindirect-branch=thunk-extern -mindirect-branch-register)
|
||||
RETPOLINE_VDSO_CFLAGS := $(call cc-option,-mindirect-branch=thunk-inline -mindirect-branch-register)
|
||||
RETPOLINE_CFLAGS := -mindirect-branch=thunk-extern -mindirect-branch-register
|
||||
RETPOLINE_VDSO_CFLAGS := -mindirect-branch=thunk-inline -mindirect-branch-register
|
||||
endif
|
||||
ifdef CONFIG_CC_IS_CLANG
|
||||
RETPOLINE_CFLAGS := -mretpoline-external-thunk
|
||||
|
|
@ -37,10 +37,11 @@ export RETPOLINE_VDSO_CFLAGS
|
|||
|
||||
# For gcc stack alignment is specified with -mpreferred-stack-boundary,
|
||||
# clang has the option -mstack-alignment for that purpose.
|
||||
ifneq ($(call cc-option, -mpreferred-stack-boundary=4),)
|
||||
ifdef CONFIG_CC_IS_GCC
|
||||
cc_stack_align4 := -mpreferred-stack-boundary=2
|
||||
cc_stack_align8 := -mpreferred-stack-boundary=3
|
||||
else ifneq ($(call cc-option, -mstack-alignment=16),)
|
||||
endif
|
||||
ifdef CONFIG_CC_IS_CLANG
|
||||
cc_stack_align4 := -mstack-alignment=4
|
||||
cc_stack_align8 := -mstack-alignment=8
|
||||
endif
|
||||
|
|
@ -83,19 +84,7 @@ KBUILD_RUSTFLAGS += -Ctarget-feature=-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-av
|
|||
#
|
||||
CC_FLAGS_FPU := -msse -msse2
|
||||
ifdef CONFIG_CC_IS_GCC
|
||||
# Stack alignment mismatch, proceed with caution.
|
||||
# GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
|
||||
# (8B stack alignment).
|
||||
# See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53383
|
||||
#
|
||||
# The "-msse" in the first argument is there so that the
|
||||
# -mpreferred-stack-boundary=3 build error:
|
||||
#
|
||||
# -mpreferred-stack-boundary=3 is not between 4 and 12
|
||||
#
|
||||
# can be triggered. Otherwise gcc doesn't complain.
|
||||
CC_FLAGS_FPU += -mhard-float
|
||||
CC_FLAGS_FPU += $(call cc-option,-msse -mpreferred-stack-boundary=3,-mpreferred-stack-boundary=4)
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_X86_KERNEL_IBT),y)
|
||||
|
|
@ -159,7 +148,7 @@ else
|
|||
|
||||
# Don't autogenerate traditional x87 instructions
|
||||
KBUILD_CFLAGS += -mno-80387
|
||||
KBUILD_CFLAGS += $(call cc-option,-mno-fp-ret-in-387)
|
||||
KBUILD_CFLAGS += -mno-fp-ret-in-387
|
||||
|
||||
# By default gcc and clang use a stack alignment of 16 bytes for x86.
|
||||
# However the standard kernel entry on x86-64 leaves the stack on an
|
||||
|
|
@ -171,7 +160,7 @@ else
|
|||
KBUILD_CFLAGS += $(cc_stack_align8)
|
||||
|
||||
# Use -mskip-rax-setup if supported.
|
||||
KBUILD_CFLAGS += $(call cc-option,-mskip-rax-setup)
|
||||
KBUILD_CFLAGS += -mskip-rax-setup
|
||||
|
||||
ifdef CONFIG_X86_NATIVE_CPU
|
||||
KBUILD_CFLAGS += -march=native
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user