On Thu, Aug 28, 2025 at 4:32 AM Richard Biener <[email protected]> wrote: > > On Thu, Aug 28, 2025 at 1:00 PM Sam James <[email protected]> wrote: > > > > Richard Biener <[email protected]> writes: > > > > > On Thu, Aug 28, 2025 at 7:23 AM Sam James <[email protected]> wrote: > > >> > > >> GNU2 TLS descriptors were introduced in 2006 (r0-73091-g5bf5a10b1ccacf) > > >> but were only opt-in with -mtls-dialect=gnu2. They are more efficient > > >> and it's time to enable them by default. > > >> > > >> Builds on the --with-tls= machinery from r16-3355-g96a291c4bb0b8a. > > >> > > >> We achieve this for GNU/Linux IA-32/X86-64 targets by checking if ld > > >> emits > > >> GLIBC_ABI_GNU2_TLS, using its presence to decide if we can default to > > >> -mtls-dialect=gnu2. > > >> > > >> For PR ld/33130, newer ld will add GLIBC_ABI_GNU2_TLS if either > > >> unconfigured > > >> (auto mode) or if configured with --enable-gnu2-tls-tag. In auto mode, > > >> GLIBC_ABI_GNU2_TLS is only added if glibc provides it. In explicit mode, > > >> the > > >> user has asked for this behavior and binaries will depend on > > >> GLIBC_ABI_GNU2_TLS > > >> and fixed glibc. Hence the presence of GLIBC_ABI_GNU2_TLS tells us if we > > >> can > > >> safely default to GNU2 TLS descriptors. We added GLIBC_ABI_GNU2_TLS in > > >> glibc > > >> to indicate that PR dynamic-link/33129 is fixed. > > >> > > >> If distributions wish to opt-out of this for systems which meet the above > > >> conditions, they can either configure GCC using --with-tls=gnu, or > > >> configure > > >> binutils with --disable-gnu2-tls-tag: if this is necessary, it is > > >> recommended > > >> to use --with-tls=gnu instead, to avoid affecting the ecosystem > > >> negatively by > > >> having unmarked binaries. > > > > > > I wonder if we can piggy-back on the existing --with-glibc-version=... > > > somehow? > > > > Yeah, that sounds OK. I can have a look, if you're okay in principle > > with doing it "optimistically" (i.e. not the only condition for > > defaulting), so: > > > > * --with-glibc-version=new-enough => default to gnu2 > > * unpassed --with-glibc-version => use the test from this patch > > ("optimistic") > > * --with-glibc-version=too-old => don't default to gnu2 > > I'm mostly concerned about auto-testing at build time. I'm fine with > defaulting > to tls2 for GCC 16 as "flag day" on x86_64-*-gnu-linux, I'd expect a > diagnostic > when --with-glibc-version=too-old conflicts with the --with-tls setting.
How does --with-glibc-version work for glibc release branches which have GLIBC_ABI_GNU2_TLS version tag backport? > Since it is ABI-ish, I want to see it explicit in my configury - > meaning _I_ will > add a --with-tls= to GCC 16 packaging, defaulting to old for old codestreams. > > Richard. > > > > [...] > > > > sam -- H.J.
