]> sourceware.org Git - glibc.git/commit
hurd: Only check for TLS initialization inside rtld or in static builds
authorSergey Bugaev <bugaevc@gmail.com>
Sun, 19 Mar 2023 15:10:07 +0000 (18:10 +0300)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Mon, 10 Apr 2023 21:33:30 +0000 (23:33 +0200)
commitb37899d34d2190ef4b454283188f22519f096048
treed21e03749c679cfa3659cc9acb126903668c7897
parent4644fb9c4c10287c875dc60c345a3eb6f4c8e87b
hurd: Only check for TLS initialization inside rtld or in static builds

When glibc is built as a shared library, TLS is always initialized by
the call of TLS_INIT_TP () macro made inside the dynamic loader, prior
to running the main program (see dl-call_tls_init_tp.h). We can take
advantage of this: we know for sure that __LIBC_NO_TLS () will evaluate
to 0 in all other cases, so let the compiler know that explicitly too.

Also, only define _hurd_tls_init () and TLS_INIT_TP () under the same
conditions (either !SHARED or inside rtld), to statically assert that
this is the case.

Other than a microoptimization, this also helps with avoiding awkward
sharing of the __libc_tls_initialized variable between ld.so and libc.so
that we would have to do otherwise -- we know for sure that no sharing
is required, simply because __libc_tls_initialized would always be set
to true inside libc.so.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <20230319151017.531737-25-bugaevc@gmail.com>
sysdeps/mach/hurd/Makefile
sysdeps/mach/hurd/i386/dl-tls-initialized.c [new file with mode: 0644]
sysdeps/mach/hurd/i386/tls.h
sysdeps/mach/hurd/x86/init-first.c
sysdeps/mach/hurd/x86_64/dl-tls-initialized.c [new file with mode: 0644]
sysdeps/mach/hurd/x86_64/tls.h
This page took 0.042788 seconds and 5 git commands to generate.