8631a2
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
8631a2
From: Peter Jones <pjones@redhat.com>
8631a2
Date: Thu, 2 Aug 2018 10:56:38 -0400
8631a2
Subject: [PATCH] Disable non-wordsize allocations on arm
8631a2
8631a2
Signed-off-by: Peter Jones <pjones@redhat.com>
8631a2
---
8631a2
 configure.ac | 20 ++++++++++++++++++++
8631a2
 1 file changed, 20 insertions(+)
8631a2
8631a2
diff --git a/configure.ac b/configure.ac
f6e916
index 819212095..9323c1254 100644
8631a2
--- a/configure.ac
8631a2
+++ b/configure.ac
8631a2
@@ -1234,6 +1234,26 @@ if test "x$target_cpu" = xarm; then
8631a2
     done
8631a2
   ])
8631a2
 
8631a2
+  AC_CACHE_CHECK([for options to disable movt and movw relocations],
8631a2
+		 grub_cv_target_cc_mword_relocations,
8631a2
+		 [grub_cv_target_cc_mword_relocations=no
8631a2
+		  for cand in "-mword-relocations" ; do
8631a2
+		    if test x"$grub_cv_target_cc_mword_relocations" != xno ; then
8631a2
+		      break
8631a2
+		    fi
8631a2
+		    CFLAGS="$TARGET_CFLAGS $cand -Werror"
8631a2
+		    CPPFLAGS="$TARGET_CPPFLAGS"
8631a2
+		    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
8631a2
+				      [grub_cv_target_cc_mword_relocations="$cand"],
8631a2
+				      [])
8631a2
+		  done
8631a2
+		 ])
8631a2
+  if test x"$grub_cv_target_cc_mword_relocations" = xno ; then
8631a2
+    AC_MSG_ERROR(["your compiler doesn't support disabling movw/movt relocations"])
8631a2
+  else
8631a2
+    TARGET_CFLAGS="$TARGET_CFLAGS $grub_cv_target_cc_mword_relocations"
8631a2
+  fi
8631a2
+
8631a2
   if test x"$grub_cv_target_cc_mno_movt" != xno ; then
8631a2
     # A trick so that clang doesn't see it on link stage
8631a2
     TARGET_CPPFLAGS="$TARGET_CPPFLAGS $grub_cv_target_cc_mno_movt"