From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa4.mentor.iphmx.com (esa4.mentor.iphmx.com [68.232.137.252]) by sourceware.org (Postfix) with ESMTPS id 1AFC33858403 for ; Wed, 24 Nov 2021 23:19:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1AFC33858403 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com IronPort-SDR: saTzu61tJETAA93fjGcjyYHl8CAwHIAOvIoF/TlVgdplLF3PiThY9Uwx9sXIHdjyO6I8UHn3u5 foFPWgvo7IeajtJ2cTB5NJZHTzOtyWZ43gNkQ/ZFbDPXmnPrJcXoz3RmDLi/tNasaKCpv6gJZC czpYew/9rCZU/5M1d4n1/iFm/OkaydPY9a3ZAxGbTWUg/WP855C3wPEIfXQYrl77G8RDESn/Y4 RcY6UnqpvTX9rqvwe5Udw9TA+nWJYVnamJEGh1OdrUiWq8vrPdLwHsqD8sjTEjFpI8VqJZLchd zTiIXKj93e0/Q64Vc7+gkd9X X-IronPort-AV: E=Sophos;i="5.87,261,1631606400"; d="scan'208";a="68909590" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa4.mentor.iphmx.com with ESMTP; 24 Nov 2021 15:19:35 -0800 IronPort-SDR: nSgxVZCYwyFR79gG7zQYvzMAkpH+KRWmTOxkkAhVZDEz2YmMnGo5RGUhPXNGKM/ekEwGIZu+yn vhZur7VimSdywg7x4OkLJtSLaLY2qMdLvVH6HZAvFY5kgYvfKjPZv14kF9tYJCbi3rFNkik0IF mHuR9lRdsatmoqmtaTOnvqTVJHualGTLskqZ4cJut9Iw9uNMNvkmktjmdklFaI7VGuwAtfqzHs qkewdhJEILR44BoHvn28Fqz12K9X8XmkDcKx8MPOjE7CEzwSXrd34vpePOyjanmWrqnu5nNS2l /gs= Date: Wed, 24 Nov 2021 23:19:29 +0000 From: Joseph Myers X-X-Sender: jsm28@digraph.polyomino.org.uk To: Florian Weimer CC: Subject: Re: Why -static-libgcc? (Or: Do we need a build-time libc.so linker script?) In-Reply-To: <87y25dmc7k.fsf@oldenburg.str.redhat.com> Message-ID: References: <87y25dmc7k.fsf@oldenburg.str.redhat.com> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-11.mgc.mentorg.com (139.181.222.11) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-3115.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP, URIBL_BLACK autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Wed, 24 Nov 2021 23:19:37 -0000 On Wed, 24 Nov 2021, Florian Weimer via Libc-alpha wrote: > Why do we use -static-libgcc? Doesn't this invalidate some of our > tests, because users do not generally build with -static-libgcc? There is a principle that (a) building glibc should not require a GCC built with shared libgcc (to avoid circular dependencies, because building shared libgcc requires having first built shared libc) and (b) if you build glibc with a static-only C-only inhibit_libc GCC, the resulting stripped binaries should be identical to those you get from a longer alternating sequence of GCC and glibc builds (in particular, the binaries should be identical to those you get from building with shared libgcc available) (note that this requires appropriate use of --with-glibc-version when configuring that first GCC in some cases - and that, while I verified the "identical stripped binaries" property when implementing --with-glibc-version and related glibc build fixes, I haven't checked it recently and it's possible it could have regressed since 2013). So building installed shared libraries needs to avoid any dependence on shared libgcc (unless such dependence is handled in a way not requiring shared libgcc to be available at build time - note that we know the libgcc_s SONAME via shlib-versions, so if desired we could insert a DT_NEEDED for it without using the real library, by building a dummy shared library to link against or otherwise). Testing is not expected to work fully with a static-only C-only inhibit_libc GCC, so using the real shared libgcc in linking tests should be OK (and desirable when the tests correspond to normal user code that would end up linking with shared libgcc, on the general principle of testing something as close as possible to how people would use installed glibc). -- Joseph S. Myers joseph@codesourcery.com