grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 4/6] configure: Add -mno-gpopt option


From: Vladimir Serbinenko
Subject: [PATCH 4/6] configure: Add -mno-gpopt option
Date: Mon, 2 Sep 2024 03:22:52 +0300

Without it compiler generates GPREL16 references which do not work
with our memory layout

Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
---
 configure.ac | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/configure.ac b/configure.ac
index fe5493246..c3d9398ab 100644
--- a/configure.ac
+++ b/configure.ac
@@ -802,9 +802,21 @@ if test "x$target_cpu" = xmips || test "x$target_cpu" = 
xmipsel ; then
   if test "x$grub_cv_cc_mflush_func" = xyes; then
     TARGET_CFLAGS="$TARGET_CFLAGS -mflush-func=grub_red_herring"
   fi
+
+  AC_CACHE_CHECK([whether -mno-gpopt works], [grub_cv_cc_mno_gpopt], [
+    CFLAGS="$TARGET_CFLAGS -mno-gpopt -Werror"
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
+        [grub_cv_cc_mno_gpopt=yes],
+       [grub_cv_cc_mno_gpopt=no])
+  ])
+
+  if test "x$grub_cv_cc_mno_gpopt" = xyes; then
+    TARGET_CFLAGS="$TARGET_CFLAGS -mno-gpopt"
+  fi
 fi
 
 
+
 # Force no alignment to save space on i386.
 if test "x$target_cpu" = xi386; then
   TARGET_CFLAGS="$TARGET_CFLAGS -falign-functions=1"
-- 
2.39.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]