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