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