Skip to content

Commit a3046a6

Browse files
sulixrichardweinberger
authored andcommitted
um: Only disable SSE on clang to work around old GCC bugs
As part of the Rust support for UML, we disable SSE (and similar flags) to match the normal x86 builds. This both makes sense (we ideally want a similar configuration to x86), and works around a crash bug with SSE generation under Rust with LLVM. However, this breaks compiling stdlib.h under gcc < 11, as the x86_64 ABI requires floating-point return values be stored in an SSE register. gcc 11 fixes this by only doing register allocation when a function is actually used, and since we never use atof(), it shouldn't be a problem: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99652 Nevertheless, only disable SSE on clang setups, as that's a simple way of working around everyone's bugs. Fixes: 8849818 ("rust: arch/um: Disable FP/SIMD instruction to match x86") Reported-by: Roberto Sassu <[email protected]> Link: https://lore.kernel.org/linux-um/[email protected]/ Tested-by: Roberto Sassu <[email protected]> Tested-by: SeongJae Park <[email protected]> Signed-off-by: David Gow <[email protected]> Reviewed-by: Vincenzo Palazzo <[email protected]> Tested-by: Arthur Grillo <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
1 parent 7e364e5 commit a3046a6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

arch/x86/Makefile.um

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,14 @@ core-y += arch/x86/crypto/
33

44
#
55
# Disable SSE and other FP/SIMD instructions to match normal x86
6+
# This is required to work around issues in older LLVM versions, but breaks
7+
# GCC versions < 11. See:
8+
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99652
69
#
10+
ifeq ($(CONFIG_CC_IS_CLANG),y)
711
KBUILD_CFLAGS += -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx
812
KBUILD_RUSTFLAGS += -Ctarget-feature=-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-avx,-avx2
13+
endif
914

1015
ifeq ($(CONFIG_X86_32),y)
1116
START := 0x8048000

0 commit comments

Comments
 (0)