Skip to content

Commit 3c6d405

Browse files
committed
Merge tag 'x86_build_for_v5.17_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 build fix from Borislav Petkov: "A fix for cross-compiling the compressed stub on arm64 with clang" * tag 'x86_build_for_v5.17_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/boot/compressed: Move CLANG_FLAGS to beginning of KBUILD_CFLAGS
2 parents 25f8c77 + 5fe392f commit 3c6d405

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

arch/x86/boot/compressed/Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ KCOV_INSTRUMENT := n
2828
targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma \
2929
vmlinux.bin.xz vmlinux.bin.lzo vmlinux.bin.lz4 vmlinux.bin.zst
3030

31-
KBUILD_CFLAGS := -m$(BITS) -O2
31+
# CLANG_FLAGS must come before any cc-disable-warning or cc-option calls in
32+
# case of cross compiling, as it has the '--target=' flag, which is needed to
33+
# avoid errors with '-march=i386', and future flags may depend on the target to
34+
# be valid.
35+
KBUILD_CFLAGS := -m$(BITS) -O2 $(CLANG_FLAGS)
3236
KBUILD_CFLAGS += -fno-strict-aliasing -fPIE
3337
KBUILD_CFLAGS += -Wundef
3438
KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
@@ -47,7 +51,6 @@ KBUILD_CFLAGS += -D__DISABLE_EXPORTS
4751
# Disable relocation relaxation in case the link is not PIE.
4852
KBUILD_CFLAGS += $(call as-option,-Wa$(comma)-mrelax-relocations=no)
4953
KBUILD_CFLAGS += -include $(srctree)/include/linux/hidden.h
50-
KBUILD_CFLAGS += $(CLANG_FLAGS)
5154

5255
# sev.c indirectly inludes inat-table.h which is generated during
5356
# compilation and stored in $(objtree). Add the directory to the includes so

0 commit comments

Comments
 (0)