mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-23 13:30:06 +00:00
216455bc28
members to the end, so a libpthread compiled with !USE_TLS will still find other members properly. * sysdeps/i386/i486/bits/string.h (__strcpy_g): Add dummy output operand for DEST memory. Fix dummy input operand to use SRC. Reported by Davin McCall <davmac@ozonline.com.au>. * sysdeps/generic/libc-tls.c (__libc_setup_tls): Account for TCB alignment when initializing the DTV entry. * elf/dl-load.c (_dl_map_object_from_fd): If we hit a TLS segment when TLS has not been set up, try to set it up if we can. * elf/tst-tls4.c: Revert last change. * elf/tst-tls5.c: Likewise. * elf/tst-tls6.c: Likewise. * elf/tst-tls7.c: Likewise. * elf/tst-tls8.c: Likewise. * elf/tst-tls9.c: Likewise. * sysdeps/generic/dl-tls.c [SHARED] (_dl_tls_setup): New function. * sysdeps/generic/ldsodefs.h: Declare it. * elf/Versions (ld: GLIBC_PRIVATE): Add it. * sysdeps/generic/libc-tls.c (init_slotinfo): New static inline function, broken out of __libc_setup_tls. (init_static_tls): Likewise. (__libc_setup_tls): Call them. (_dl_tls_setup): New function, uses new subroutines. * elf/dl-close.c (free_slotinfo): Make argument pointer to pointer. Clear the pointer when returning true. (libc_freeres_fn) [SHARED]: If GL(dl_initial_dtv) is null, free the first element of the slotinfo list too. * sysdeps/generic/dl-tls.c (_dl_determine_tlsoffset): Define only if [SHARED]. * sysdeps/generic/ldsodefs.h (_dl_next_tls_modid): Declare as hidden. (_dl_determine_tlsoffset): Likewise. * elf/rtld.c (_dl_initial_error_catch_tsd): Renamed from startup_error_tsd, made global. (dl_main): Update initialization. * elf/dl-tsd.c: Likewise. * sysdeps/generic/ldsodefs.h: Declare it.
59 lines
1.8 KiB
C
59 lines
1.8 KiB
C
/* Thread-local data used by error handling for runtime dynamic linker.
|
|
Copyright (C) 2002 Free Software Foundation, Inc.
|
|
This file is part of the GNU C Library.
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU Lesser General Public
|
|
License as published by the Free Software Foundation; either
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Lesser General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
License along with the GNU C Library; if not, write to the Free
|
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|
02111-1307 USA. */
|
|
|
|
#ifdef _LIBC_REENTRANT
|
|
|
|
# include <ldsodefs.h>
|
|
# include <tls.h>
|
|
|
|
# ifndef SHARED
|
|
|
|
/* _dl_error_catch_tsd points to this for the single-threaded case.
|
|
It's reset by the thread library for multithreaded programs
|
|
if we're not using __thread. */
|
|
void ** __attribute__ ((const))
|
|
_dl_initial_error_catch_tsd (void)
|
|
{
|
|
# if USE___THREAD
|
|
static __thread void *data;
|
|
# else
|
|
static void *data;
|
|
# endif
|
|
return &data;
|
|
}
|
|
void **(*_dl_error_catch_tsd) (void) __attribute__ ((const))
|
|
= &_dl_initial_error_catch_tsd;
|
|
|
|
# elif USE___THREAD
|
|
|
|
/* libpthread sets _dl_error_catch_tsd to point to this function.
|
|
We define it here instead of in libpthread so that it doesn't
|
|
need to have a TLS segment of its own just for this one pointer. */
|
|
|
|
void ** __attribute__ ((const))
|
|
__libc_dl_error_tsd (void)
|
|
{
|
|
static __thread void *data;
|
|
return &data;
|
|
}
|
|
|
|
# endif /* SHARED */
|
|
|
|
#endif /* _LIBC_REENTRANT */
|