From patchwork Thu Feb 11 10:19:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddhesh Poyarekar X-Patchwork-Id: 42015 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F17BD3870867; Thu, 11 Feb 2021 10:22:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F17BD3870867 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1613038927; bh=LVIS7xSx3jbk+/I7dpM3NF4KKgT6xKa246w+k86HDxg=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=FzRTBp+0+Wis+oTmcf8r6Tw6QytjtOLKuKnp/bNLfiVPhKgtY/IOs+mSCjcK85XY0 O3ghSZQCauqZc4Tie9z7UYSS0I3GwJyYH4rKgFxElLAqGe+RkEhayc6ZHE9dWSkoVw OJUXCnOabXJHdkKvCgZZBZjT7ogfSKvR0Xaiecao= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org 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 To: libc-alpha@sourceware.org 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 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-Patchwork-Original-From: Siddhesh Poyarekar via Libc-alpha From: Siddhesh Poyarekar Reply-To: Siddhesh Poyarekar Cc: fweimer@redhat.com Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" 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 = s_isinfF s_isnanF s_finiteF s_copysignF s_modfF s_scalbnF s_frexpF \ gen-calls = s_ldexpF generated += $(foreach s,.c .S,$(call type-foreach, $(calls:s_%=m_%$(s)))) routines = $(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 = $(call type-foreach, $(calls:s_%=m_%)) ifeq ($(build-mathvec),yes) # We need to install libm.so and libm.a as linker scripts