From patchwork Thu Dec 7 20:11:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 1873425 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SmQQt3Mp8z23nK for ; Fri, 8 Dec 2023 07:11:50 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E1F773858C2C for ; Thu, 7 Dec 2023 20:11:47 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from esa1.mentor.iphmx.com (esa1.mentor.iphmx.com [68.232.129.153]) by sourceware.org (Postfix) with ESMTPS id 174AA3858D20 for ; Thu, 7 Dec 2023 20:11:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 174AA3858D20 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 174AA3858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=68.232.129.153 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701979900; cv=none; b=pUI/buBcd+MRyq6uQknKnGEbFAZlED/PE8OzcvKQPDC7DjMNA3vBjSKgEfoBQKUY+qt0VrYb5iwDD7pTS6i2zkhDbZgF/FWkBQfkmR/WCYqlQgTZo6R/hbDBoPCjpjYzeJ15xPaZQT5zOa9o4ErOymaUJz2UOLPAHDPv1jKDqg4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701979900; c=relaxed/simple; bh=51jdoaY8Vv4IYeXOEvqpfub7UQwEy+kJ12iHEvL+AUY=; h=Date:From:To:Subject:Message-ID:MIME-Version; b=WmYjiuai9SRQ+cbIsHbAHWSgpMc+rZCXiUtL9ZQzvWvE6SFvqXI6DwwqdJuwMeTUyGHARnqe4M62CbTCvPBiMI6sV8JuzRX/K5SxS1pvFXTIV1gnR/nmi5UqWH8bo4fV664OpG95RYopZNorxR3jGnSLtxvLILRAghK8A7tR0mg= ARC-Authentication-Results: i=1; server2.sourceware.org X-CSE-ConnectionGUID: +y1KtWhnQfC+d+ug4Qwtfg== X-CSE-MsgGUID: LBt4yJsETqyhUQQ5mr/WRQ== X-IronPort-AV: E=Sophos;i="6.04,258,1695715200"; d="scan'208";a="27978532" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa1.mentor.iphmx.com with ESMTP; 07 Dec 2023 12:11:37 -0800 IronPort-SDR: Jwb83ejYkTI38iImDFMFLavD9QPe7Ij6pFODYfVeyraY/jGy+HeOf5kum4xIjKRcKEBK4Dh3Bp CPs/w1XIvBSrJ9RilfeprP3Cj4kQQUXzn8aGw2024fR+Tr/dqSQB/Z2piGoN+eLLRIsP4mFr0M ikT1hELOTGY0bSPwoNJbMjxFwd8CNgxi+ey7RfyUeqiQCYTdgVKidk5nmZep5zoKWQ+mA5ni4k zSwynYh29gWQRmhCKFsp+c3Gpx4iTpNbPrSddBbSka7mKT3+yFpMrtq8X2qkRpaCcmQAKHyUga iQo= Date: Thu, 7 Dec 2023 20:11:33 +0000 From: Joseph Myers To: Subject: Do not build sparc32 libgcc functions into static libc Message-ID: <53dc50f-8f2b-da88-fa85-44883878201b@codesourcery.com> MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-15.mgc.mentorg.com (139.181.222.15) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-3108.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Since GCC commit f31a019d1161ec78846473da743aedf49cca8c27 "Emit funcall external declarations only if actually used.", the glibc testsuite has failed to build for 32-bit SPARC with GCC mainline. /scratch/jmyers/glibc-bot/install/compilers/sparc64-linux-gnu/lib/gcc/sparc64-glibc-linux-gnu/14.0.0/../../../../sparc64-glibc-linux-gnu/bin/ld: /scratch/jmyers/glibc-bot/install/compilers/sparc64-linux-gnu/lib/gcc/sparc64-glibc-linux-gnu/14.0.0/32/libgcc.a(_divsi3.o): in function `.div': /scratch/jmyers/glibc-bot/src/gcc/libgcc/config/sparc/lb1spc.S:138: multiple definition of `.div'; /scratch/jmyers/glibc-bot/build/glibcs/sparcv9-linux-gnu/glibc/libc.a(sdiv.o):/scratch/jmyers/glibc-bot/src/glibc/gnulib/../sysdeps/sparc/sparc32/sparcv9/sdiv.S:13: first defined here /scratch/jmyers/glibc-bot/install/compilers/sparc64-linux-gnu/lib/gcc/sparc64-glibc-linux-gnu/14.0.0/../../../../sparc64-glibc-linux-gnu/bin/ld: disabling relaxation; it will not work with multiple definitions collect2: error: ld returned 1 exit status make[3]: *** [../Rules:298: /scratch/jmyers/glibc-bot/build/glibcs/sparcv9-linux-gnu/glibc/nptl/tst-cancel24-static] Error 1 https://sourceware.org/pipermail/libc-testresults/2023q4/012154.html I'm not sure of the exact sequence of undefined references that cause first the glibc object file defining .div and then the libgcc object file defining both .div and .udiv to be pulled in (which must have been perturbed by that GCC change in a way that introduced the build failure), but I think the failure illustrates that it's inherently fragile for glibc to define symbols in separate object files that libgcc defines in the same object file - and indeed for glibc to redefine libgcc symbols at all, since the division into object files shouldn't really be part of the interface between libgcc and libc. These symbols appear to be in libc only for compatibility, maybe one of the cases where they were accidentally exported from shared libc in glibc 2.0 before the introduction of symbol versioning and so programs started expecting shared libc to provide them. Thus, there is no need to have them in static libc. Add this set of libgcc functions to shared-only-routines so they are no longer provided in static libc. (No change is made regarding .mul - dotmul source file - since unlike the other symbols in this grouping, it doesn't actually appear to be a libgcc symbol, at least in current GCC.) Tested with build-many-glibcs.py for sparcv9-linux-gnu with GCC mainline. Reviewed-by: Adhemerval Zanella diff --git a/sysdeps/sparc/sparc32/Makefile b/sysdeps/sparc/sparc32/Makefile index b792e56710..cc1db68cc6 100644 --- a/sysdeps/sparc/sparc32/Makefile +++ b/sysdeps/sparc/sparc32/Makefile @@ -17,6 +17,7 @@ ifeq ($(subdir),gnulib) sysdep_routines = dotmul umul $(divrem) alloca +shared-only-routines += umul $(divrem) endif # gnulib divrem := sdiv udiv rem urem