Skip to content

Commit 163d9c6

Browse files
committed
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
2 parents 98afd4d + 2c6a28f commit 163d9c6

2 files changed

Lines changed: 8 additions & 25 deletions

File tree

arch/x86/Kconfig

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1734,11 +1734,7 @@ config X86_UMIP
17341734
config CC_HAS_IBT
17351735
# GCC >= 9 and binutils >= 2.29
17361736
# Retpoline check to work around https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93654
1737-
# Clang/LLVM >= 14
1738-
# https://github.com/llvm/llvm-project/commit/e0b89df2e0f0130881bf6c39bf31d7f6aac00e0f
1739-
# https://github.com/llvm/llvm-project/commit/dfcf69770bc522b9e411c66454934a37c1f35332
1740-
def_bool ((CC_IS_GCC && $(cc-option, -fcf-protection=branch -mindirect-branch-register)) || \
1741-
(CC_IS_CLANG && CLANG_VERSION >= 140000)) && \
1737+
def_bool ((CC_IS_GCC && $(cc-option, -fcf-protection=branch -mindirect-branch-register)) || CC_IS_CLANG) && \
17421738
$(as-instr,endbr64)
17431739

17441740
config X86_CET
@@ -1750,8 +1746,6 @@ config X86_KERNEL_IBT
17501746
prompt "Indirect Branch Tracking"
17511747
def_bool y
17521748
depends on X86_64 && CC_HAS_IBT && HAVE_OBJTOOL
1753-
# https://github.com/llvm/llvm-project/commit/9d7001eba9c4cb311e03cd8cdc231f9e579f2d0f
1754-
depends on !LD_IS_LLD || LLD_VERSION >= 140000
17551749
select OBJTOOL
17561750
select X86_CET
17571751
help

arch/x86/Makefile

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ else
1313
endif
1414

1515
ifdef CONFIG_CC_IS_GCC
16-
RETPOLINE_CFLAGS := $(call cc-option,-mindirect-branch=thunk-extern -mindirect-branch-register)
17-
RETPOLINE_VDSO_CFLAGS := $(call cc-option,-mindirect-branch=thunk-inline -mindirect-branch-register)
16+
RETPOLINE_CFLAGS := -mindirect-branch=thunk-extern -mindirect-branch-register
17+
RETPOLINE_VDSO_CFLAGS := -mindirect-branch=thunk-inline -mindirect-branch-register
1818
endif
1919
ifdef CONFIG_CC_IS_CLANG
2020
RETPOLINE_CFLAGS := -mretpoline-external-thunk
@@ -37,10 +37,11 @@ export RETPOLINE_VDSO_CFLAGS
3737

3838
# For gcc stack alignment is specified with -mpreferred-stack-boundary,
3939
# clang has the option -mstack-alignment for that purpose.
40-
ifneq ($(call cc-option, -mpreferred-stack-boundary=4),)
40+
ifdef CONFIG_CC_IS_GCC
4141
cc_stack_align4 := -mpreferred-stack-boundary=2
4242
cc_stack_align8 := -mpreferred-stack-boundary=3
43-
else ifneq ($(call cc-option, -mstack-alignment=16),)
43+
endif
44+
ifdef CONFIG_CC_IS_CLANG
4445
cc_stack_align4 := -mstack-alignment=4
4546
cc_stack_align8 := -mstack-alignment=8
4647
endif
@@ -83,19 +84,7 @@ KBUILD_RUSTFLAGS += -Ctarget-feature=-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-av
8384
#
8485
CC_FLAGS_FPU := -msse -msse2
8586
ifdef CONFIG_CC_IS_GCC
86-
# Stack alignment mismatch, proceed with caution.
87-
# GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
88-
# (8B stack alignment).
89-
# See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53383
90-
#
91-
# The "-msse" in the first argument is there so that the
92-
# -mpreferred-stack-boundary=3 build error:
93-
#
94-
# -mpreferred-stack-boundary=3 is not between 4 and 12
95-
#
96-
# can be triggered. Otherwise gcc doesn't complain.
9787
CC_FLAGS_FPU += -mhard-float
98-
CC_FLAGS_FPU += $(call cc-option,-msse -mpreferred-stack-boundary=3,-mpreferred-stack-boundary=4)
9988
endif
10089

10190
ifeq ($(CONFIG_X86_KERNEL_IBT),y)
@@ -159,7 +148,7 @@ else
159148

160149
# Don't autogenerate traditional x87 instructions
161150
KBUILD_CFLAGS += -mno-80387
162-
KBUILD_CFLAGS += $(call cc-option,-mno-fp-ret-in-387)
151+
KBUILD_CFLAGS += -mno-fp-ret-in-387
163152

164153
# By default gcc and clang use a stack alignment of 16 bytes for x86.
165154
# However the standard kernel entry on x86-64 leaves the stack on an
@@ -171,7 +160,7 @@ else
171160
KBUILD_CFLAGS += $(cc_stack_align8)
172161

173162
# Use -mskip-rax-setup if supported.
174-
KBUILD_CFLAGS += $(call cc-option,-mskip-rax-setup)
163+
KBUILD_CFLAGS += -mskip-rax-setup
175164

176165
ifdef CONFIG_X86_NATIVE_CPU
177166
KBUILD_CFLAGS += -march=native

0 commit comments

Comments
 (0)