]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Allow compilation without thumb-interwork as long as no thumb is
authorVladimir Serbinenko <phcoder@gmail.com>
Wed, 18 Dec 2013 12:33:39 +0000 (13:33 +0100)
committerVladimir Serbinenko <phcoder@gmail.com>
Wed, 18 Dec 2013 12:33:39 +0000 (13:33 +0100)
involved or only thumb2 is used.

ChangeLog
INSTALL
conf/Makefile.common
configure.ac

index 80c7cafa940f43550a91684cb799457c0c410aca..4cb362c708e82751791201f4a6d7944565021ecb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-12-18  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       Allow compilation without thumb-interwork as long as no thumb is
+       involved or only thumb2 is used.
+
 2013-12-18  Vladimir Serbinenko  <phcoder@gmail.com>
 
        Use -Wl,--no-relax rather than -mno-relax for uniformity.
diff --git a/INSTALL b/INSTALL
index 6ee21155d99879cb61886f66e19a36372403c4cb..afc957ca997d550a0410043fb5d48e52a0b8e5f3 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -17,6 +17,7 @@ configuring the GRUB.
         much bigger binaries.
        earlier versions not tested
   Note: clang 3.2 or later works for arm
+       None of tested clang versions generated usable thumb code
        earlier versions not tested
   Note: clang 3.3 or later works for arm64
        earlier versions have no arm64 support
index 015cd29ce4f424a02e211e07cd9abf6728c03269..6128797ed0d2c7c888d0ade51645a32d58c4ef60 100644 (file)
@@ -15,8 +15,6 @@ if COND_sparc64_emu
   LDFLAGS_PLATFORM = -Wl,--no-relax
 endif
 if COND_arm
-  CFLAGS_PLATFORM += -mthumb-interwork
-  CCASFLAGS_PLATFORM = -mthumb-interwork
 if !COND_emu
   LDFLAGS_PLATFORM = -Wl,--wrap=__clear_cache
 endif
index cc66ea912d9ad8d220b1bd01055bb6669fa3aae4..5a2eea4efcc7171dfdd1d59be2f5705074b3c3e3 100644 (file)
@@ -871,6 +871,29 @@ if test "x$target_cpu" = xarm; then
   if test "x$grub_cv_cc_mlong_calls" = xyes; then
     TARGET_CFLAGS="$TARGET_CFLAGS -mlong-calls"
   fi
+  AC_CACHE_CHECK([whether option -mthumb-interwork works], grub_cv_cc_mthumb_interwork, [
+    CFLAGS="$TARGET_CFLAGS -mthumb-interwork -Werror"
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
+                     [grub_cv_cc_mthumb_interwork=yes],
+                     [grub_cv_cc_mthumb_interwork=no])
+  ])
+  if test "x$grub_cv_cc_mthumb_interwork" = xyes; then
+    TARGET_CFLAGS="$TARGET_CFLAGS -mthumb-interwork"
+  elif test "x$grub_cv_cc_target_clang" = xno ; then
+    AC_MSG_ERROR([your compiler doesn't support -mthumb-interwork])
+  else
+    CFLAGS="$TARGET_CFLAGS"
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
+#if defined (__thumb__) && !defined (__thumb2__)
+#error thumb without interworking
+#endif
+]])],
+                     [no_interwork_ok=yes],
+                     [no_interwork_ok=no])
+    if test x$no_interwork_ok = xno ; then
+       AC_MSG_ERROR([attempt to compile to thumb with no thumb interwork])
+    fi
+  fi
 fi
 
 #