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