From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57692) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b0F1S-0001Xd-H1 for qemu-devel@nongnu.org; Tue, 10 May 2016 17:16:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b0F1F-0001TT-8r for qemu-devel@nongnu.org; Tue, 10 May 2016 17:16:54 -0400 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:33668) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b0F1E-0001TG-Jv for qemu-devel@nongnu.org; Tue, 10 May 2016 17:16:41 -0400 Received: by mail-wm0-x243.google.com with SMTP id r12so5338722wme.0 for ; Tue, 10 May 2016 14:16:39 -0700 (PDT) Date: Tue, 10 May 2016 22:16:35 +0100 From: James Clarke Message-ID: <20160510211635.GA48818@Jamess-MacBook.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] [PATCH] Fix linking relocatable objects on Sparc List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org, James Clarke 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 --- configure | 13 +++++++++++++ rules.mak | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/configure b/configure index c37fc5f..c3583b2 100755 --- a/configure +++ b/configure @@ -4508,6 +4508,18 @@ if compile_prog "" "" ; then have_fsxattr=yes fi +################################################# +# Sparc implicitly links with --relax, which is +# incompatible with -r. It does no harm to give +# it on other platforms too. + +cat > $TMPC << EOF +int foo(void) { return 0; } +EOF +if compile_prog "" "-nostdlib -Wl,-r -Wl,--no-relax"; then + LD_REL_FLAGS="-Wl,--no-relax" +fi + ########################################## # End of CC checks # After here, no more $cc or $ld runs @@ -5513,6 +5525,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 diff --git a/rules.mak b/rules.mak index d1ff311..fc2c961 100644 --- a/rules.mak +++ b/rules.mak @@ -93,7 +93,7 @@ module-common.o: CFLAGS += $(DSO_OBJ_CFLAGS) $(if $(findstring /,$@),$(call quiet-command,cp $@ $(subst /,-,$@), " CP $(subst /,-,$@)")) -LD_REL := $(CC) -nostdlib -Wl,-r +LD_REL := $(CC) -nostdlib -Wl,-r $(LD_REL_FLAGS) %.mo: $(call quiet-command,$(LD_REL) -o $@ $^," LD -r $(TARGET_DIR)$@") -- 2.8.2