From nobody Tue Feb 10 01:34:29 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1597682919; cv=none; d=zohomail.com; s=zohoarc; b=DovWrH5vDyGwFNSGcZ40wLs28dVreHLpBM1IIQQEDWdbLFAeCVC+5uLME6VLEGQrEW0orq6KHr+4Npm3XPbi9bGn9rvD5zTDdE8vmCejk8+hAfujAb0aaTyR2kotLQ25kIoQ5de0QE2gzG3uvSaquhF+16Fa2QSMGGUzrjlfpec= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597682919; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=dspYanX3zf7a9yxolnnruaw1M3atSamdkc1hvEVqzGE=; b=X5PlwlWPydwf7TpXotGZQt5xBDBEqeMjumCN2v9c78aZlHhkbJMGoaEb4mflJNH2N/hgxpQCKwYnS9ebwWdFnLu5sVerWnzQvA+6pDZsd3i9oTL8RB9bX5OfFBskOthxzZrUS/aZ6lL6qPL2BvtTbeVPvRQ+cB7FUD23vyXbVXo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1597682919571996.3538483508892; Mon, 17 Aug 2020 09:48:39 -0700 (PDT) Received: from localhost ([::1]:54588 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k7gPZ-0002LR-Du for importer@patchew.org; Mon, 17 Aug 2020 10:46:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40560) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k7gGh-0003Zq-PV for qemu-devel@nongnu.org; Mon, 17 Aug 2020 10:37:47 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:45580) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k7gGf-00063U-PU for qemu-devel@nongnu.org; Mon, 17 Aug 2020 10:37:47 -0400 Received: by mail-wr1-x42a.google.com with SMTP id z18so15240511wrm.12 for ; Mon, 17 Aug 2020 07:37:45 -0700 (PDT) Received: from donizetti.redhat.com ([2001:b07:6468:f312:a0d1:fc42:c610:f977]) by smtp.gmail.com with ESMTPSA id i22sm34966603wrb.45.2020.08.17.07.37.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Aug 2020 07:37:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dspYanX3zf7a9yxolnnruaw1M3atSamdkc1hvEVqzGE=; b=bVS4MP7OD0Kk3M6bl9iuuY6LTLaC1GxovV8fQcQrNNUOcjQrWdf/TW9FLIG8uMCRIz vwBHSGcdXRuvK0VKMKf7+C6iryNR5ysVY9Vx3X3hKfyBr3VZDovLq8oL/YVRM4V+BhOd nQNYTVYnq67KAedV3eH1+mGvtZ1TxOY8aG/bRob2OblUmonunBeJK2azHkhbL/PSuFBt qpqkajgNXzRF2oDVjbOcqY7LeCwec9a7qobxQPhRKF9uXdqD4nwXl8MzEyO1NmDR5N1k CVkQmGEQ9pBYyejfoFKGLNqeIsfHCC3SXq+pLLfgcHfaojLN6tUB59WEoVcNae0kXGkk 7YNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=dspYanX3zf7a9yxolnnruaw1M3atSamdkc1hvEVqzGE=; b=oJtzsiK2IyW2Gt09LO8l9hGimvZk+cr6NB2VXCso0zHQCT5+tXNJNWpofT8+dMks0G FtNkTyAjBIRVdBmRAMfgy4T+FoM+u/812WNxJMFoe2Y3KZIPNMw/7Q6ZLqh2fOtBQJo2 XYp9x2AtCVpFfYyiGMlYT8208eZ6sYyhqBgZRr23lIbkqtRzVU+IMB0SOvQ7aY0z6Ax0 9wIngiNuQrLBKD4pxDZ8O5HEjG2FuT0vodLhg6nD18yFYFGU+jVvuV+TRrPrImZMqiPl 6jTwgz67ripdQ/VIeT2ZBiTTVh3CGyfC1pZIDs6yPk9y5OMWnqych08Q/3b5MEZM1P1S EluQ== X-Gm-Message-State: AOAM531d78I+rzIuxW6nuxwqgBzSCexspN+GsnTn+9pt0CQzvN8quJq5 9vBm6PWSVpV8ZvhKairx+9PUzk5wlzc= X-Google-Smtp-Source: ABdhPJxm18IhDgtyUK3NJHGPa/63dgzgkJSxxgTCMOQB849PF+zBOfwO3bGZmrUBuHOLo4l7hHh3CA== X-Received: by 2002:adf:fb87:: with SMTP id a7mr16896296wrr.390.1597675064179; Mon, 17 Aug 2020 07:37:44 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 017/150] build-sys hack: link with whole .fa archives Date: Mon, 17 Aug 2020 16:35:10 +0200 Message-Id: <20200817143723.343284-18-pbonzini@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200817143723.343284-1-pbonzini@redhat.com> References: <20200817143723.343284-1-pbonzini@redhat.com> 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: pass client-ip=2a00:1450:4864:20::42a; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x42a.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 0 X-Spam_score: 0.0 X-Spam_bar: / X-Spam_report: (0.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=1, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Marc-Andr=C3=A9 Lureau In order to link the *-obj-y files into tests, we will make static libraries of them in Meson, and then link them as whole archives into the tests. To separate regular static libraries from link-whole libraries, give them a different file extension. Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Paolo Bonzini --- rules.mak | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/rules.mak b/rules.mak index e79a4005a7..5ab42def82 100644 --- a/rules.mak +++ b/rules.mak @@ -39,6 +39,13 @@ find-symbols =3D $(if $1, $(sort $(shell $(NM) -P -g $1 = | $2))) defined-symbols =3D $(call find-symbols,$1,awk '$$2!=3D"U"{print $$1}') undefined-symbols =3D $(call find-symbols,$1,awk '$$2=3D=3D"U"{print $$1}') =20 +WL :=3D -Wl, +ifdef CONFIG_DARWIN +whole-archive =3D $(WL)-force_load,$1 +else +whole-archive =3D $(WL)--whole-archive $1 $(WL)--no-whole-archive +endif + # All the .mo objects in -m variables are also added into corresponding -y # variable in unnest-vars, but filtered out here, when LINK is called. # @@ -54,11 +61,12 @@ undefined-symbols =3D $(call find-symbols,$1,awk '$$2= =3D=3D"U"{print $$1}') # This is necessary because the exectuable itself may not use the function= , in # which case the function would not be linked in. Then the DSO loading will # fail because of the missing symbol. -process-archive-undefs =3D $(filter-out %.a %.mo,$1) \ +process-archive-undefs =3D $(filter-out %.a %.fa %.mo,$1) \ $(addprefix $(WL_U), \ - $(filter $(call defined-symbols,$(filter %.a, $1)), \ + $(filter $(call defined-symbols,$(filter %.a %.fa, $1= )), \ $(call undefined-symbols,$(filter %.mo,$1)))= ) \ - $(filter %.a,$1) + $(foreach l,$(filter %.fa,$1),$(call whole-archive,$l)) \ + $(filter %.a,$1) =20 extract-libs =3D $(strip $(foreach o,$(filter-out %.mo,$1),$($o-libs))) expand-objs =3D $(strip $(sort $(filter %.o,$1)) \ @@ -122,7 +130,7 @@ LD_REL :=3D $(CC) -nostdlib $(LD_REL_FLAGS) modules: =20 %$(EXESUF): %.o - $(call LINK,$(filter %.o %.a %.mo, $^)) + $(call LINK,$(filter %.o %.a %.mo %.fa, $^)) =20 %.a: $(call quiet-command,rm -f $@ && $(AR) rcs $@ $^,"AR","$(TARGET_DIR)$@") @@ -378,7 +386,7 @@ define unnest-vars $(error $o added in $v but $o-objs is not set))) $(shell mkdir -p ./ $(sort $(dir $($v)))) # Include all the .d files - $(eval -include $(patsubst %.o,%.d,$(patsubst %.mo,%.d,$($v)))) + $(eval -include $(patsubst %.o,%.d,$(patsubst %.mo,%.d,$(filter %.= o,$($v))))) $(eval $v :=3D $(filter-out %/,$($v)))) endef =20 --=20 2.26.2