* configure.ac: Compile with -fPIC when compiling with clang on

mips.
This commit is contained in:
Vladimir Serbinenko 2013-11-22 12:50:41 +01:00
parent 63a45330cb
commit 9cf12b20af
2 changed files with 16 additions and 4 deletions

View File

@ -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

View 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"