[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Allow compiling without -mthumb-interwork as long as no thumb is
Vladimir 'φ-coder/phcoder' Serbinenko
[PATCH] Allow compiling without -mthumb-interwork as long as no thumb is involved
Fri, 06 Dec 2013 14:34:29 +0100
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131005 Icedove/17.0.9
My experiments with clang have shown that it doesn't accept
-mthumb-interwork and generates code that isn't interworkable
on armv5t even with explicit -march=armv5t.
Moreover the thumb code it generates even with -march=armv5t
contains Thumb-2 instructions which qemu rightfully interprets as
bl to random address corrupting lr in process and producing
crash dumps with senseless $pc and $lr.
So any kind of thumb1 support with clang is in any case out of
Then the question if it makes sense to allow (but mention that it's
not supported) compilations with clang and old GCC as long as they
use only arm and thumb2.
Which maintainance costs would it create?
Having clang allowed helps for comparisons and to uncover hidden bugs
(like .bss alignment bug in sparc64 port) but this usefulness is limited.
diff --git a/INSTALL b/INSTALL
index b91d975..3be0271 100644
@@ -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
diff --git a/conf/Makefile.common b/conf/Makefile.common
index 4ec2b81..c390490 100644
@@ -11,8 +11,6 @@ if COND_sparc64_ieee1275
LDFLAGS_PLATFORM = -Wl,-melf64_sparc -mno-relax
- CFLAGS_PLATFORM += -mthumb-interwork
- CCASFLAGS_PLATFORM = -mthumb-interwork
LDFLAGS_PLATFORM = -Wl,--wrap=__clear_cache
diff --git a/configure.ac b/configure.ac
index d13cd3d..0fb40e8 100644
@@ -858,6 +858,28 @@ if test "x$target_cpu" = xarm; then
if test "x$grub_cv_cc_mlong_calls" = xyes; then
+ AC_CACHE_CHECK([whether option -mthumb-interwork works],
+ CFLAGS="$TARGET_CFLAGS -mthumb-interwork -Werror"
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])],
+ if test "x$grub_cv_cc_mthumb_interwork" = xyes; then
+ TARGET_CFLAGS="$TARGET_CFLAGS -mthumb-interwork"
+ # clang defaults to thumb-interwork but not GCC
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
+#if defined (__thumb__) && !defined (__thumb2__)
+#error thumb without interworking
+ if test x$no_interwork_ok = xno ; then
+ AC_MSG_ERROR([attempt to compile to thumb with no thumb interwork])
Description: OpenPGP digital signature
|[Prev in Thread]
||[Next in Thread]|
- [PATCH] Allow compiling without -mthumb-interwork as long as no thumb is involved,
Vladimir 'φ-coder/phcoder' Serbinenko <=