public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Joseph Myers <joseph@codesourcery.com>
To: Florian Weimer <fweimer@redhat.com>
Cc: <libc-alpha@sourceware.org>
Subject: Re: Why -static-libgcc? (Or: Do we need a build-time libc.so linker script?)
Date: Wed, 24 Nov 2021 23:19:29 +0000	[thread overview]
Message-ID: <alpine.DEB.2.22.394.2111242307250.1698965@digraph.polyomino.org.uk> (raw)
In-Reply-To: <87y25dmc7k.fsf@oldenburg.str.redhat.com>

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

  reply	other threads:[~2021-11-24 23:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-24 22:16 Florian Weimer
2021-11-24 23:19 ` Joseph Myers [this message]
2022-01-10 13:00   ` Florian Weimer
2022-01-10 13:26     ` Adhemerval Zanella
2022-01-11  0:58     ` Joseph Myers
2022-04-19 11:57       ` Florian Weimer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.22.394.2111242307250.1698965@digraph.polyomino.org.uk \
    --to=joseph@codesourcery.com \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).