aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-bsp/grub/files/0001-x86_64-amd-avoid-SSE-register-return-with-SSE-disabl.patch
blob: 69d62e6471b530021060d43ef2fafca578dbc7f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
From d80b85dd61db9261b6cfd0d43a2f1c035627310b Mon Sep 17 00:00:00 2001
From: "Arsalan H. Awan" <Arsalan_Awan@mentor.com>
Date: Tue, 6 Apr 2021 15:01:41 +0500
Subject: [PATCH] x86_64/amd: avoid SSE register return with SSE disabled

When GRUB is compiled with -march=znver1 or -march=znver2 using the GCC
v9.3 and above, the compilation fails with the following error:

recipe-sysroot-native/usr/lib/x86_64-amd-linux/gcc/x86_64-amd-linux/
  10.2.0/include/shaintrin.h:40:1:
  error: SSE register return with SSE disabled

What's interesting, is that -march=skylake also implies -mbmi which
defines __BMI__ but compilation succeeds.

It is probably due to different BMI implementations on AMD and INTEL
processors and the way compiler uses related instructions.

Signed-off-by: Arsalan H. Awan <Arsalan_Awan@mentor.com>
---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 0b1bc48..dbe7a71 100644
--- a/configure.ac
+++ b/configure.ac
@@ -833,7 +833,7 @@ fi
 if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$platform" != xemu; then
   # Some toolchains enable these features by default, but they need
   # registers that aren't set up properly in GRUB.
-  TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow -mfpmath=387"
+  TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow -mfpmath=387 -mno-bmi"
 fi
 
 # GRUB doesn't use float or doubles at all. Yet some toolchains may decide
-- 
2.25.1