From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from cyan.elm.relay.mailchannels.net (cyan.elm.relay.mailchannels.net [23.83.212.47]) by sourceware.org (Postfix) with ESMTPS id 3740B3870867 for ; Thu, 11 Feb 2021 10:22:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 3740B3870867 X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 284AD921B08; Thu, 11 Feb 2021 10:22:03 +0000 (UTC) Received: from pdx1-sub0-mail-a12.g.dreamhost.com (100-96-16-13.trex.outbound.svc.cluster.local [100.96.16.13]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id B24BC922836; Thu, 11 Feb 2021 10:22:02 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from pdx1-sub0-mail-a12.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384) by 100.96.16.13 (trex/6.0.2); Thu, 11 Feb 2021 10:22:03 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Stop-Hook: 224535625657feb2_1613038922971_1614156732 X-MC-Loop-Signature: 1613038922971:1901998806 X-MC-Ingress-Time: 1613038922970 Received: from pdx1-sub0-mail-a12.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a12.g.dreamhost.com (Postfix) with ESMTP id 1904B7F246; Thu, 11 Feb 2021 02:22:02 -0800 (PST) Received: from rhbox.intra.reserved-bit.com (unknown [1.186.101.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a12.g.dreamhost.com (Postfix) with ESMTPSA id A9E5C87B22; Thu, 11 Feb 2021 02:21:59 -0800 (PST) X-DH-BACKEND: pdx1-sub0-mail-a12 From: Siddhesh Poyarekar To: libc-alpha@sourceware.org Cc: fweimer@redhat.com, carlos@redhat.com Subject: [PATCH 2/2] Avoid adding duplicated symbols into static libraries Date: Thu, 11 Feb 2021 15:49:08 +0530 Message-Id: <20210211101908.2825685-3-siddhesh@sourceware.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210211101908.2825685-1-siddhesh@sourceware.org> References: <20210211101908.2825685-1-siddhesh@sourceware.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3492.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_NONE, KAM_DMARC_STATUS, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NEUTRAL, TXREP, URIBL_BLACK autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Feb 2021 10:22:05 -0000 Some math functions (such as __isnan*) are built into both libm and libc because they are needed in libc. The symbol gets exported from libc.so and not libm.so, because of which dynamic linking works fine; the symbols are always resolved from libc.so and libm.so uses its internal copy of the same function if needed. When linking statically though, the libm variants get used throughout because the symbols are exported in both archives and libm.a is searched first. This patch removes these duplicate objects from the libm.a archive so that programs always link to libc in both, the static and dynamic case. The difference this will cause is that libm uses of these functions will start using the libc versions in the !SHARED case. This is harmless at the moment because the objects are identical except for their names. Some of these duplicates could be removed from libm.so too, but I avoided that in the interest of retaining an internal reference if at all those functions get used within libm in future. --- math/Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/math/Makefile b/math/Makefile index 687aa5d510..c4cc1b2068 100644 --- a/math/Makefile +++ b/math/Makefile @@ -196,6 +196,9 @@ calls =3D s_isinfF s_isnanF s_finiteF s_copysignF s_m= odfF s_scalbnF s_frexpF \ gen-calls =3D s_ldexpF generated +=3D $(foreach s,.c .S,$(call type-foreach, $(calls:s_%=3Dm_%$= (s)))) routines =3D $(call type-foreach, $(calls)) +# The $(calls) that are shared between libm and libc are not included in= static +# libm so the symbols end up in exactly one place. +libm-shared-only-routines =3D $(call type-foreach, $(calls:s_%=3Dm_%)) =20 ifeq ($(build-mathvec),yes) # We need to install libm.so and libm.a as linker scripts --=20 2.29.2