Skip to content

Commit 437e88a

Browse files
nathanchanceKAGA-KOKO
authored andcommitted
x86/build: Remove -pipe from KBUILD_CFLAGS
Commit 77b0bf5 ("kbuild/Makefile: Prepare for using macros in inline assembly code to work around asm() related GCC inlining bugs") added -Wa,- to KBUILD_CFLAGS, which breaks compiling with Clang (hangs indefinitely at compiling init/main.o). This happens because while Clang accepts -pipe (and has it documented in its list of supported flags), it silently ignores it after this 2010 commit (thanks to Nick Desaulniers for tracking this down), meaning that gas just infinitely waits for stdin and never receives it. llvm-mirror/clang@c19a12d Initially, I had suggested just add -Wa,- to KBUILD_CFLAGS when GCC was being used but that was before realizing it is because Clang doesn't do anything with -pipe. H. Peter Anvin suggested checking to see if -pipe gives us any gains out of GCC. Turns out it might actually be hurting: With -pipe: real 3m40.813s real 3m44.449s real 3m39.648s Without -pipe: real 3m38.492s real 3m38.335s real 3m38.975s The issue of -Wa,- being passed along to gas without -pipe being supported should still probably be fixed on the LLVM side (open issue: https://bugs.llvm.org/show_bug.cgi?id=39410) but this is not as much of a workaround anymore since it helps both GCC and Clang. Suggested-by: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Tested-by: Nick Desaulniers <ndesaulniers@google.com> Reviewed-by: Nadav Amit <namit@vmware.com> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> Cc: Borislav Petkov <bp@alien8.de> Cc: Kees Cook <keescook@chromium.org> Cc: Masahiro Yamada <yamada.masahiro@socionext.com> Link: ClangBuiltLinux/linux#213 Link: https://lkml.kernel.org/r/20181023231125.27976-1-natechancellor@gmail.com
1 parent b42967d commit 437e88a

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

arch/x86/Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,6 @@ ifdef CONFIG_X86_64
213213
KBUILD_LDFLAGS += $(call ld-option, -z max-page-size=0x200000)
214214
endif
215215

216-
# Speed up the build
217-
KBUILD_CFLAGS += -pipe
218216
# Workaround for a gcc prelease that unfortunately was shipped in a suse release
219217
KBUILD_CFLAGS += -Wno-sign-compare
220218
#
@@ -239,7 +237,7 @@ archheaders:
239237
archmacros:
240238
$(Q)$(MAKE) $(build)=arch/x86/kernel arch/x86/kernel/macros.s
241239

242-
ASM_MACRO_FLAGS = -Wa,arch/x86/kernel/macros.s -Wa,-
240+
ASM_MACRO_FLAGS = -Wa,arch/x86/kernel/macros.s
243241
export ASM_MACRO_FLAGS
244242
KBUILD_CFLAGS += $(ASM_MACRO_FLAGS)
245243

0 commit comments

Comments
 (0)