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