summaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorJames Clarke <jrtc27@jrtc27.com>2016-06-06 12:02:50 +0100
committerMichael Tokarev <mjt@tls.msk.ru>2016-06-07 18:19:06 +0300
commit6969ec6cfd1293efd16bf9c7c7063b44bc6880ce (patch)
treeb3215e74647b17ad5a8f68dc51aa3a7b02b31b49 /configure
parenta2c5eaf7a9f6172e8dc5cfeb283e086f592cf50a (diff)
Fix linking relocatable objects on Sparc
On Sparc, gcc implicitly passes --relax to the linker, but -r is incompatible with this. Therefore, if --no-relax is supported, it should be passed to the linker. Signed-off-by: James Clarke <jrtc27@jrtc27.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure21
1 files changed, 21 insertions, 0 deletions
diff --git a/configure b/configure
index 6d01d968b8..3ad0b6371c 100755
--- a/configure
+++ b/configure
@@ -31,6 +31,7 @@ TMPCXX="${TMPDIR1}/${TMPB}.cxx"
TMPL="${TMPDIR1}/${TMPB}.lo"
TMPA="${TMPDIR1}/lib${TMPB}.la"
TMPE="${TMPDIR1}/${TMPB}.exe"
+TMPMO="${TMPDIR1}/${TMPB}.mo"
rm -f config.log
@@ -4526,6 +4527,25 @@ if compile_prog "" "" ; then
have_fsxattr=yes
fi
+#################################################
+# Sparc implicitly links with --relax, which is
+# incompatible with -r, so --no-relax should be
+# given. It does no harm to give it on other
+# platforms too.
+
+# Note: the prototype is needed since QEMU_CFLAGS
+# contains -Wmissing-prototypes
+cat > $TMPC << EOF
+extern int foo(void);
+int foo(void) { return 0; }
+EOF
+if ! compile_object ""; then
+ error_exit "Failed to compile object file for LD_REL_FLAGS test"
+fi
+if do_cc -nostdlib -Wl,-r -Wl,--no-relax -o $TMPMO $TMPO; then
+ LD_REL_FLAGS="-Wl,--no-relax"
+fi
+
##########################################
# End of CC checks
# After here, no more $cc or $ld runs
@@ -5529,6 +5549,7 @@ else
fi
echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak
+echo "LD_REL_FLAGS=$LD_REL_FLAGS" >> $config_host_mak
echo "LIBS+=$LIBS" >> $config_host_mak
echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
echo "EXESUF=$EXESUF" >> $config_host_mak