From patchwork Wed Feb 26 21:53:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 25433 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qg0-f72.google.com (mail-qg0-f72.google.com [209.85.192.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C099B20636 for ; Wed, 26 Feb 2014 21:53:33 +0000 (UTC) Received: by mail-qg0-f72.google.com with SMTP id q107sf2431700qgd.3 for ; Wed, 26 Feb 2014 13:53:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=H14P+yBhUauqkH2cp2m8kPFKXW/bL9GhRZx9KUgArjw=; b=GhfxdboYKowItR/Es1YYXLW1Bu8t7UGjn8sz1oSURzm1ro7Z8ylmrf6m5Ko8RybJ55 W8i/mn8g5AZIiFgpqWBdMC9JqEAoVRmRDp5iH1Y7JYqAizrx5/Yv0bBKvkOEcnUlr2qd yS5Df1c7LjpDQh0CaBmIhW1GE1pea1pHgHPJo4dbs0gpFV1M04N3PbajztBVY8QEFDYq U4R4EfuaNuk4KdhaXJNb7srbujD/920TDNrQwWVMn0p1GLW33diR8NN6jNTIOj0JKITB svkol4rxf6F9I6auL+K2J1DY5yBVP0rFg5wqpkcmD9Jxz/FC5vNVcbU5AXBliOOhT1+A YGnw== X-Gm-Message-State: ALoCoQl2OMEiLOYGUI4zMi4g14F2Vr8yS2qFMxQaLHpr4XA3w6FKsQBW2sDHnfTKH9QyUVuKNPdH X-Received: by 10.224.47.129 with SMTP id n1mr3659139qaf.4.1393451613592; Wed, 26 Feb 2014 13:53:33 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.101.70 with SMTP id t64ls414888qge.1.gmail; Wed, 26 Feb 2014 13:53:33 -0800 (PST) X-Received: by 10.58.4.138 with SMTP id k10mr7669313vek.8.1393451613469; Wed, 26 Feb 2014 13:53:33 -0800 (PST) Received: from mail-ve0-f171.google.com (mail-ve0-f171.google.com [209.85.128.171]) by mx.google.com with ESMTPS id tr5si586438vdc.117.2014.02.26.13.53.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 26 Feb 2014 13:53:33 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.171; Received: by mail-ve0-f171.google.com with SMTP id oz11so2932010veb.30 for ; Wed, 26 Feb 2014 13:53:33 -0800 (PST) X-Received: by 10.58.186.132 with SMTP id fk4mr7540751vec.9.1393451613375; Wed, 26 Feb 2014 13:53:33 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp57291vcz; Wed, 26 Feb 2014 13:53:32 -0800 (PST) X-Received: by 10.180.188.66 with SMTP id fy2mr9783807wic.45.1393451612423; Wed, 26 Feb 2014 13:53:32 -0800 (PST) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id ch9si1723587wjb.79.2014.02.26.13.53.32 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 26 Feb 2014 13:53:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::1 as permitted sender) client-ip=2001:8b0:1d0::1; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1WImPy-0006PW-3g; Wed, 26 Feb 2014 21:53:30 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Markus Armbruster , =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [PATCH] configure: Always build with -fno-common Date: Wed, 26 Feb 2014 21:53:30 +0000 Message-Id: <1393451610-24617-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , MacOSX doesn't pull .o files from .a archives if the symbol that it requires is one which the .o file defines as a common symbol. (Common symbols are those declared without "extern"; the linker will merge together common symbols with the same name, so redeclaring the same variable in two compilation units results in them referring to the same symbol rather than a compilation error). This MacOSX difference from traditional linker behaviour means that "make check" produces link errors: Undefined symbols for architecture x86_64: "_cur_mon", referenced from: _error_vprintf in libqemuutil.a(qemu-error.o) _error_printf in libqemuutil.a(qemu-error.o) _error_printf_unless_qmp in libqemuutil.a(qemu-error.o) _error_print_loc in libqemuutil.a(qemu-error.o) _error_report in libqemuutil.a(qemu-error.o) ld: symbol(s) not found for architecture x86_64 in this case because "cur_mon" is a common symbol in libqemustub.a(mon-set-error.o). In QEMU we don't make any use at all of the common symbol functionality, so we can avoid this problem entirely simply by compiling with -fno-common. Enable this option for all builds, not just MacOSX, so that if we ever inadvertently introduce multiple definitions of some variable that will be immediately spotted as a build error rather than only breaking the MacOSX build. Suggested-by: Markus Armbruster Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- Thanks to Markus for pointing out that -fno-common was the simple solution to this problem. make check now works on MacOSX, although due to a race condition in the version of glib I'm stuck on (2.22.4) I have to periodically use "killall -CHLD gtester" to unwedge it... configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 423f435..ff438e4 100755 --- a/configure +++ b/configure @@ -369,7 +369,7 @@ sdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}" ARFLAGS="${ARFLAGS-rv}" # default flags for all hosts -QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS" +QEMU_CFLAGS="-fno-strict-aliasing -fno-common $QEMU_CFLAGS" QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS" QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS" QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"