From patchwork Tue Jun 7 15:22:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 9161677 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 71AE960571 for ; Tue, 7 Jun 2016 15:29:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 63C2A26E1A for ; Tue, 7 Jun 2016 15:29:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5853127248; Tue, 7 Jun 2016 15:29:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AECD927B13 for ; Tue, 7 Jun 2016 15:29:42 +0000 (UTC) Received: from localhost ([::1]:50978 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAIwn-0002et-R7 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 07 Jun 2016 11:29:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40630) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAIqT-0004zB-5r for qemu-devel@nongnu.org; Tue, 07 Jun 2016 11:23:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bAIqO-0005mz-QI for qemu-devel@nongnu.org; Tue, 07 Jun 2016 11:23:08 -0400 Received: from isrv.corpit.ru ([86.62.121.231]:51905) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAIqO-0005mr-IH; Tue, 07 Jun 2016 11:23:04 -0400 Received: from tsrv.tls.msk.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 8CB2F40C46; Tue, 7 Jun 2016 18:23:01 +0300 (MSK) Received: from tls.msk.ru (mjt.vpn.tls.msk.ru [192.168.177.99]) by tsrv.tls.msk.ru (Postfix) with SMTP id 5EF22ADB; Tue, 7 Jun 2016 18:23:00 +0300 (MSK) Received: (nullmailer pid 29055 invoked by uid 1000); Tue, 07 Jun 2016 15:23:00 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Date: Tue, 7 Jun 2016 18:22:56 +0300 Message-Id: <6969ec6cfd1293efd16bf9c7c7063b44bc6880ce.1465312856.git.mjt@msgid.tls.msk.ru> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 86.62.121.231 Subject: [Qemu-devel] [PULL 14/51] Fix linking relocatable objects on Sparc X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-trivial@nongnu.org, Michael Tokarev , James Clarke Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: 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 Signed-off-by: Michael Tokarev --- configure | 21 +++++++++++++++++++++ rules.mak | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 6d01d96..3ad0b63 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 diff --git a/rules.mak b/rules.mak index 4a8f464..dca5718 100644 --- a/rules.mak +++ b/rules.mak @@ -95,7 +95,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)$@")