Control: tags -1 patch Control: forwarded -1 http://lists.nongnu.org/archive/html/qemu-devel/2016-05/msg01566.html
Hi, On Fri, 04 Dec 2015 01:58:14 +0100 John Paul Adrian Glaubitz <[email protected]> wrote: > qemu currently fails to build from source on sparc64 because it sets > both the linker parameters "-r" and "--relax": > > cc -nostdlib -Wl,-r -o block/iscsi.mo block/iscsi.o > /usr/bin/ld: --relax and -r may not be used together > collect2: error: ld returned 1 exit status > make[1]: *** [block/iscsi.mo] Error 1 > /«BUILDDIR»/qemu-2.4+dfsg/rules.mak:117: recipe for target 'block/iscsi.mo' > failed > > This happens because gcc is called with "-Wl,-r" which does not gcc's > internal mechanism to disable "--relax" at the same time (for whatever > reason). > > Thus, on sparc*, gcc should be either called with just "-Wl" but not with "-r" > or the option "-no-relax" should be passed in order to fix this problem. > > ghc upstream had the same problem and fixed the issue by setting "-no-relax" > for sparc [1]. > > Please apply a similar fix for qemu. I have submitted a patch upstream, and attached a backported version. Regards, James
--- a/configure
+++ b/configure
@@ -4505,6 +4505,18 @@
fi
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
@@ -5471,6 +5483,7 @@
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 "LIBTOOLFLAGS=$LIBTOOLFLAGS" >> $config_host_mak
echo "LIBS+=$LIBS" >> $config_host_mak
echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
--- a/rules.mak
+++ b/rules.mak
@@ -111,7 +111,7 @@
$(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)$@")
signature.asc
Description: PGP signature

