From patchwork Tue May 10 21:16:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jessica Clarke X-Patchwork-Id: 9063401 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 32211BF29F for ; Tue, 10 May 2016 21:17:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7E3B620173 for ; Tue, 10 May 2016 21:17:06 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id 648CB20172 for ; Tue, 10 May 2016 21:17:05 +0000 (UTC) Received: from localhost ([::1]:49145 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b0F1b-0001cJ-Po for patchwork-qemu-devel@patchwork.kernel.org; Tue, 10 May 2016 17:17:03 -0400 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jrtc27.com; s=google; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=dJOimZeHyZvqBiD5rsE3tAR/UIHhDWuWnGdhU/E179U=; b=oQskLcegWR10fo95BHiJGaxOs0eThmOaNuAJytWu9UFpNKix8k1J5A9ClayxYJtWSz 1kFA5ICC+PbWn7uGIQB0NhaHNt5O8513Uwxn3Qx+0mqmzV9YSzdWf9ZvQnMIq0rbcjK6 4yyfyi7ejDuBObyY/h3dd3+i+7Ao3+s0gnXak= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=dJOimZeHyZvqBiD5rsE3tAR/UIHhDWuWnGdhU/E179U=; b=A1bzdke9idg/XD2GWFmht5Wz6heVHooKN14G0NadZtGGCYHEDvGJJ3x1ZVJZpmRtCJ TF6RvPjc/OuQfHFrzRFNgMvkypEgz/UuKh23BXdvnSgjNJZNNqJjDkK71nmSxRT31/L1 +66XbzJUM+B0EEwXqVG3HSIRyUC06CgmnvFN5NNgXqSDUQrZ+STb8imeuO1KX8lqPQnn UktKpgrH+4I3Nr0g4aM1FBnFH+mOgSQ7kIOCZERUurZn1LrXoKV/k8YKQmgPgqqjRSz9 c3/Klc4CgpDRpIu1o1P3c+3bRX59BzoJERHoys7MtNQqPtuppgvF3x6ChZjGZcPk1CcV dhrw== X-Gm-Message-State: AOPr4FW1nOK7qmDXOWijVW6lNf0FdF1N9buJqNwuXRhE5MukRKDep73gpO+sl5YiMqB3ZA== X-Received: by 10.194.76.137 with SMTP id k9mr41357651wjw.3.1462914998845; Tue, 10 May 2016 14:16:38 -0700 (PDT) Received: from Jamess-MacBook.local (global-184-8.nat-1.net.cam.ac.uk. [131.111.184.8]) by smtp.gmail.com with ESMTPSA id e8sm5013547wma.2.2016.05.10.14.16.37 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 10 May 2016 14:16:37 -0700 (PDT) Received: by Jamess-MacBook.local (Postfix, from userid 501) id 585D0366CCD8; Tue, 10 May 2016 22:16:35 +0100 (BST) Date: Tue, 10 May 2016 22:16:35 +0100 From: James Clarke To: qemu-devel@nongnu.org Message-ID: <20160510211635.GA48818@Jamess-MacBook.local> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.6.1 (2016-04-27) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::243 Subject: [Qemu-devel] [PATCH] 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, James Clarke Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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)$@")