From nobody Fri Nov 1 05:36:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 170836993366419.72104516114473; Mon, 19 Feb 2024 11:12:13 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rc931-0004Yn-Jq; Mon, 19 Feb 2024 14:11:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rc92p-0004Wr-JO for qemu-devel@nongnu.org; Mon, 19 Feb 2024 14:11:16 -0500 Received: from wfhigh6-smtp.messagingengine.com ([64.147.123.157]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rc92k-0007jA-VX for qemu-devel@nongnu.org; Mon, 19 Feb 2024 14:11:15 -0500 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailfhigh.west.internal (Postfix) with ESMTP id 2B52A1800071; Mon, 19 Feb 2024 14:11:08 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Mon, 19 Feb 2024 14:11:08 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 19 Feb 2024 14:11:06 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= invisiblethingslab.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:subject:subject:to:to; s=fm3; t=1708369867; x=1708456267; bh=RxS+XGDuENg3h+qpE0HMYFyAzXU1uK69 HiERXeO7PvQ=; b=1FIB88x/eTYPQ2/DZmDaRTXxfbgq35+nslGRXHrwgeHHLKbx j1+mt0Jvh8CA6B7YqGyKCyT/coWtQrrBKC9Ap8l2mfqsWLeLhitE8fDmquL3kdcB LUsoUAi9vl5JWTjSzET53UvKZZRytffk4G8vIz7uC8vTYApiFiDNPwAdwWVvxQZ0 GCELbptihwl4MZ4ZHl6aC4B9gfNhs1R11kjUUSbBeOFBME4zJSYlHiYCDc/QQrID CFVcS4oGgVDF7TUDy6tUvWFBSXWkj0hg3ZHhCYm4pnDmgq4OcFSBo4gbxq0d9alB U1AnXUO5OEjxUhJ+2+uTbR9x0rlsfEBtVwfylQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:message-id:mime-version:reply-to:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1708369867; x=1708456267; bh=RxS+XGDuENg3h +qpE0HMYFyAzXU1uK69HiERXeO7PvQ=; b=Fp16qgmjeRi05m+9RhCs4jgaoe/m8 /0W1DdkToXSG6QcfjKD2Mq+WADqvBEcVK/htdZ8Wl8gekxm89MfhokXdyTI3r4nM yOMmCctLZ47mEbEaxWMZWwAdLf/i2pkZLhbU4bPLGoBA6pVaypkduCIDgQscBeyc kRO9y7hMXuaxS66T6k1vGaw/atc1DPPJQ+XvIqEY1eilh+a1Al+mkjStQfHeZLJF kv7lfGf4HQ7kDQwHDdlK2mwOTEdWrglPbVkmQG0vFQ0EcmyUfOGhMm9i+Vy/BdRE 6FzcaAmxXY46FTBLyKVBLZUpfVN8bXb8z+V+PgsOYi7NaEih+DTVPsuGg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdekgdduvddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofggtgfgsehtkeertdertdejnecuhfhrohhmpeforghrvghk ucforghrtgiihihkohifshhkihdqifpkrhgvtghkihcuoehmrghrmhgrrhgvkhesihhnvh hishhisghlvghthhhinhhgshhlrggsrdgtohhmqeenucggtffrrghtthgvrhhnpeelkefh udelteelleelteetveeffeetffekteetjeehlefggeekleeghefhtdehvdenucevlhhush htvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmrghrmhgrrhgvkhes ihhnvhhishhisghlvghthhhinhhgshhlrggsrdgtohhm X-ME-Proxy: Feedback-ID: i1568416f:Fastmail From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Paolo Bonzini , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Thomas Huth Subject: [PATCH v2] configure: do not require gcc runtime library for firmwares Date: Mon, 19 Feb 2024 20:10:29 +0100 Message-ID: <20240219191054.283154-1-marmarek@invisiblethingslab.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=64.147.123.157; envelope-from=marmarek@invisiblethingslab.com; helo=wfhigh6-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1708369935559100001 probe_target_compiler() when checking for multilib support checks if -nostdlib works together with -lgcc. It isn't necessary for building various components in pc-bios/optionrom, as evidenced by looking at actually used link flags there. Alpine Linux for x86_64 does not ship with 32bit libgcc, but its gcc is otherwise perfectly capable of building firmwares in pc-bios/optionrom dir. Make configure recognize this situation. Keep requiring functional -lgcc in other places. Few more may not need it, but I don't have an easy way to test. Signed-off-by: Marek Marczykowski-G=C3=B3recki --- Changes in v2: - use an option instead of positional parameter - add explicit -lgcc where it may be relevant, instead of having -lgcc as default --- configure | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/configure b/configure index ff058d6c48..3e92685221 100755 --- a/configure +++ b/configure @@ -1216,7 +1216,7 @@ have_target() { return 1 } =20 -# probe_target_compiler TARGET +# probe_target_compiler [-nostdlib-ldflags=3D...] TARGET # # Look for a compiler for the given target, either native or cross. # Set variables target_* if a compiler is found, and container_cross_* @@ -1226,6 +1226,9 @@ have_target() { # # If TARGET is a user-mode emulation target, also set build_static to # "y" if static linking is possible. +# When testing -nostdlib build, extra ldflags can be supplied with +# -nostdlib-ldflags option, useful to add -lgcc will be added for more +# extensive multilib support test # probe_target_compiler() { # reset all output variables @@ -1241,7 +1244,11 @@ probe_target_compiler() { container_cross_objcopy=3D container_cross_ranlib=3D container_cross_strip=3D + nostdlib_ldflags=3D =20 + case "$1" in + -nostdlib-ldflags=3D*) nostdlib_ldflags=3D"${1#*=3D}"; shift;; + esac target_arch=3D${1%%-*} case $target_arch in aarch64) container_hosts=3D"x86_64 aarch64" ;; @@ -1432,7 +1439,7 @@ probe_target_compiler() { case $1 in *-softmmu) if do_compiler "$target_cc" $target_cflags -o $TMPO -c $TMPC && - do_compiler "$target_cc" $target_cflags -r -nostdlib -o "${TMPDI= R1}/${TMPB}2.o" "$TMPO" -lgcc; then + do_compiler "$target_cc" $target_cflags -r -nostdlib -o "${TMPDI= R1}/${TMPB}2.o" "$TMPO" $nostdlib_ldflags; then got_cross_cc=3Dyes break fi @@ -1553,7 +1560,7 @@ if have_target i386-softmmu x86_64-softmmu && \ fi =20 if have_target ppc-softmmu ppc64-softmmu && \ - probe_target_compiler ppc-softmmu; then + probe_target_compiler -nostdlib-ldflags=3D-lgcc ppc-softmmu; then subdirs=3D"$subdirs pc-bios/vof" config_mak=3Dpc-bios/vof/config.mak echo "# Automatically generated by configure - do not modify" > $confi= g_mak @@ -1563,7 +1570,7 @@ fi =20 # Only build s390-ccw bios if the compiler has -march=3Dz900 or -march=3Dz= 10 # (which is the lowest architecture level that Clang supports) -if have_target s390x-softmmu && probe_target_compiler s390x-softmmu && \ +if have_target s390x-softmmu && probe_target_compiler -nostdlib-ldflags=3D= -lgcc s390x-softmmu && \ GIT=3Dgit "$source_path/scripts/git-submodule.sh" "$git_submodules_act= ion" roms/SLOF >> config.log 2>&1; then write_c_skeleton do_compiler "$target_cc" $target_cc_cflags -march=3Dz900 -o $TMPO -c $TM= PC @@ -1666,7 +1673,7 @@ for target in $target_list; do ;; esac =20 - if probe_target_compiler $target || test -n "$container_image"; then + if probe_target_compiler -nostdlib-ldflags=3D-lgcc $target || test -n "$= container_image"; then test -n "$container_image" && build_static=3Dy mkdir -p "tests/tcg/$target" config_target_mak=3Dtests/tcg/$target/config-target.mak --=20 2.43.0