]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* configure.ac: Compile with -fPIC when compiling with clang on
authorVladimir Serbinenko <phcoder@gmail.com>
Fri, 22 Nov 2013 11:50:41 +0000 (12:50 +0100)
committerVladimir Serbinenko <phcoder@gmail.com>
Fri, 22 Nov 2013 11:50:41 +0000 (12:50 +0100)
mips.

ChangeLog
configure.ac

index 8b21400fe3661f7e0cf6a843faa08d0bc79c30b4..6faadecdb3d07013de51085b41dfe8a9eb3f4400 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-11-22  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * configure.ac: Compile with -fPIC when compiling with clang on
+       mips.
+
 2013-11-22  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * configure.ac: Add -no-integrated-as on mips(el) to TARGET_CCASFLAGS
index 1df1e7ef43ad7e5b44dd958731512519923ea0a8..8852a9899cc509f3c49d327ac326f959a84d0db7 100644 (file)
@@ -767,10 +767,17 @@ CFLAGS="$TARGET_CFLAGS"
 
 # Position independent executable.
 grub_CHECK_PIC
-[# Need that, because some distributions ship compilers that include
-# `-fPIC' in the default specs.
-if [ x"$pic_possible" = xyes ]; then
-  TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIC"
+[# On most platforms we don't want PIC as it only makes relocations harder
+# and code less efficient. On mips we want to have one got table per module
+# and reload $gp in every function.
+# GCC implements it using symbol __gnu_local_gp in non-PIC as well.
+# However with clang we need PIC for this reloading to happen.
+# Since default varies across dictributions use either -fPIC or -fno-PIC
+# explicitly.
+if ( test x$target_cpu = xmips || test x$target_cpu = xmipsel ) && test "x$grub_cv_cc_target_clang" = xyes ; then
+   TARGET_CFLAGS="$TARGET_CFLAGS -fPIC"
+elif [ x"$pic_possible" = xyes ]; then
+   TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIC"
 fi]
 
 CFLAGS="$TARGET_CFLAGS"