ElfW(Dyn) *l_ld; /* Dynamic section of the shared object. */
struct link_map *l_next, *l_prev; /* Chain of loaded objects. */
-#ifdef USE_TLS
+#if defined(USE_TLS) && USE_TLS
/* Thread-local storage related info. */
/* Start of the initialization image. */
struct elf_resolve * prev;
/* Nothing after this address is used by gdb. */
-#if USE_TLS
+#if defined(USE_TLS) && USE_TLS
/* Thread-local storage related info. */
/* Start of the initialization image. */
unsigned long dynamic_addr, unsigned long dynamic_size);
/* Only need extra arg with some configurations */
-#if !(USE_TLS || defined __FDPIC__)
+#if !((defined(USE_TLS) && USE_TLS) || defined __FDPIC__)
# define _dl_lookup_hash(n, r, m, c, t) _dl_lookup_hash(n, r, m, c)
#endif
extern char *_dl_lookup_hash(const char *name, struct dyn_elf *rpnt,
ElfW(Dyn) *dpnt;
struct elf_resolve *tpnt;
ElfW(Phdr) *ppnt;
-#if USE_TLS
+#if defined(USE_TLS) && USE_TLS
ElfW(Phdr) *tlsppnt = NULL;
#endif
char *status, *header;
}
}
if (ppnt->p_type == PT_TLS) {
-#if USE_TLS
+#if defined(USE_TLS) && USE_TLS
if (ppnt->p_memsz == 0)
/* Nothing to do for an empty segment. */
continue;
tpnt->ppnt = (ElfW(Phdr) *) DL_RELOC_ADDR(tpnt->loadaddr, epnt->e_phoff);
tpnt->n_phent = epnt->e_phnum;
-#if USE_TLS
+#if defined(USE_TLS) && USE_TLS
if (tlsppnt) {
_dl_debug_early("Found TLS header for %s\n", libname);
#if NO_TLS_OFFSET != 0
#if 0
/* _dl_add_to_slotinfo is called by init_tls() for initial DSO
or by dlopen() for dynamically loaded DSO. */
-#if USE_TLS
+#if defined(USE_TLS) && USE_TLS
/* Add object to slot information data if necessasy. */
if (tpnt->l_tls_blocksize != 0 && tls_init_tp_called)
_dl_add_to_slotinfo ((struct link_map *) tpnt);
check_match (const ElfW(Sym) *sym, char *strtab, const char* undef_name, int type_class)
{
-#if USE_TLS
+#if defined(USE_TLS) && USE_TLS
if ((sym->st_value == 0 && (ELF_ST_TYPE(sym->st_info) != STT_TLS))
|| (type_class & (sym->st_shndx == SHN_UNDEF)))
/* No value or undefined symbol itself */
if (sym) {
/* At this point we have found the requested symbol, do binding */
-#if USE_TLS
+#if defined(USE_TLS) && USE_TLS
if (ELF_ST_TYPE(sym->st_info) == STT_TLS) {
_dl_assert(tpntp != NULL);
*tpntp = tpnt;
* more work than what is done below for the
* loader will have to happen.
*/
-#if USE_TLS
+#if defined(USE_TLS) && USE_TLS
/* This was done by _dl_memset above. */
/* tpnt->l_tls_modid = 0; */
# if NO_TLS_OFFSET != 0
#define ALLOW_ZERO_PLTGOT
-#if USE_TLS
+#if defined(USE_TLS) && USE_TLS
#include "dl-tls.c"
#endif
(*_dl_free_function) (p);
}
-#if USE_TLS
+#if defined(USE_TLS) && USE_TLS
void *_dl_memalign(size_t __boundary, size_t __size)
{
void *result;
ElfW(Addr) relro_addr = 0;
size_t relro_size = 0;
struct stat st;
-#if USE_TLS
+#if defined(USE_TLS) && USE_TLS
void *tcbp = NULL;
#endif
unlazy = RTLD_NOW;
}
-#if USE_TLS
+#if defined(USE_TLS) && USE_TLS
_dl_error_catch_tsd = &_dl_initial_error_catch_tsd;
_dl_init_static_tls = &_dl_nothread_init_static_tls;
#endif
/* Discover any TLS sections if the target supports them. */
if (ppnt->p_type == PT_TLS) {
-#if USE_TLS
+#if defined(USE_TLS) && USE_TLS
if (ppnt->p_memsz > 0) {
app_tpnt->l_tls_blocksize = ppnt->p_memsz;
app_tpnt->l_tls_align = ppnt->p_align;
app_tpnt->relro_addr = relro_addr;
app_tpnt->relro_size = relro_size;
-#if USE_TLS
+#if defined(USE_TLS) && USE_TLS
/*
* Adjust the address of the TLS initialization image in
* case the executable is actually an ET_DYN object.
}
#endif
-#if USE_TLS
+#if defined(USE_TLS) && USE_TLS
/* We do not initialize any of the TLS functionality unless any of the
* initial modules uses TLS. This makes dynamic loading of modules with
* TLS impossible, but to support it requires either eagerly doing setup
_dl_protect_relro (tpnt);
}
-#if USE_TLS
+#if defined(USE_TLS) && USE_TLS
if (!was_tls_init_tp_called && _dl_tls_max_dtv_idx > 0)
++_dl_tls_generation;
_dl_malloc_function = (void* (*)(size_t)) (intptr_t) _dl_find_hash(__C_SYMBOL_PREFIX__ "malloc",
_dl_symbol_tables, NULL, ELF_RTYPE_CLASS_PLT, NULL);
-#if USE_TLS
+#if defined(USE_TLS) && USE_TLS
/* Find the real functions and make ldso functions use them from now on */
_dl_calloc_function = (void* (*)(size_t, size_t)) (intptr_t)
_dl_find_hash(__C_SYMBOL_PREFIX__ "calloc", _dl_symbol_tables, NULL, ELF_RTYPE_CLASS_PLT, NULL);
#include <tls.h>
#endif
-#if USE_TLS
+#if defined(USE_TLS) && USE_TLS
#include <ldsodefs.h>
extern void (*_dl_init_static_tls) (struct link_map *);
extern void _dl_add_to_slotinfo(struct link_map *l);
#endif
#ifdef SHARED
-# if USE_TLS
+# if defined(USE_TLS) && USE_TLS
# include <dl-tls.h>
extern struct link_map *_dl_update_slotinfo(unsigned long int req_modid);
# endif
#include "../ldso/dl-debug.c"
-# if USE_TLS
+# if defined(USE_TLS) && USE_TLS
/*
* Giving this initialized value preallocates some surplus bytes in the
* static TLS area, see __libc_setup_tls (libc-tls.c).
};
-#if USE_TLS
+#if defined(USE_TLS) && USE_TLS
#ifdef SHARED
/*
* Systems which do not have tls_index also probably have to define
unsigned int nlist, i;
struct elf_resolve **init_fini_list;
static bool _dl_init;
-#if USE_TLS
+#if defined(USE_TLS) && USE_TLS
bool any_tls = false;
#endif
/* TODO: Should we set the protections of all pages back to R/O now ? */
-#if USE_TLS
+#if defined(USE_TLS) && USE_TLS
for (i=0; i < nlist; i++) {
struct elf_resolve *tmp_tpnt = init_fini_list[i];
tpnt = handle->dyn; /* Only search RTLD_GLOBAL objs if global object */
ret = _dl_find_hash(name2, handle, NULL, 0, &tls_tpnt);
-#if defined USE_TLS && defined SHARED
+#if defined(USE_TLS) && USE_TLS && defined SHARED
if (tls_tpnt) {
/* The found symbol is a thread-local storage variable.
Return the address for to the current thread. */
struct dyn_elf *handle;
unsigned int end;
unsigned int i, j;
-#if USE_TLS
+#if defined(USE_TLS) && USE_TLS
bool any_tls = false;
size_t tls_free_start = NO_TLS_OFFSET;
size_t tls_free_end = NO_TLS_OFFSET;
end = ppnt->p_vaddr + ppnt->p_memsz;
}
-#if USE_TLS
+#if defined(USE_TLS) && USE_TLS
/* Do the cast to make things easy. */
tls_lmap = (struct link_map *) tpnt;
free(handle->init_fini.init_fini);
free(handle);
-#if USE_TLS
+#if defined(USE_TLS) && USE_TLS
/* If we removed any object which uses TLS bump the generation counter. */
if (any_tls) {
if (__builtin_expect(++_dl_tls_generation == 0, 0)) {
#include <link.h>
#include <elf.h>
-#if USE_TLS
+#if defined(USE_TLS) && USE_TLS
#include <assert.h>
#include <tls.h>
#include <ldsodefs.h>
#include <string.h>
#endif
-#if USE_TLS
+#if defined(USE_TLS) && USE_TLS
void (*_dl_init_static_tls) (struct link_map *) = &_dl_nothread_init_static_tls;
_dl_phnum = (size_t) av[AT_PHNUM].a_un.a_val;
}
-#if USE_TLS
+#if defined(USE_TLS) && USE_TLS
/* Initialize static TLS area and DTV for current (only) thread.
libpthread implementations should provide their own hook
to handle all threads. */
}
/* Start the thread manager */
pid = 0;
-#ifdef USE_TLS
+#if defined(USE_TLS) && USE_TLS
if (__linuxthreads_initial_report_events != 0)
THREAD_SETMEM (((pthread_descr) NULL), p_report_events,
__linuxthreads_initial_report_events);
if (sp >= __pthread_manager_thread_bos && sp < __pthread_manager_thread_tos)
return manager_thread;
h = __pthread_handles + 2;
-# ifdef USE_TLS
+# if defined(USE_TLS) && USE_TLS
while (h->h_descr == NULL
|| ! (sp <= (char *) h->h_descr->p_stackaddr && sp >= h->h_bottom))
h++;
/* Main thread should accumulate times for thread manager and its
children, so that timings for main thread account for all threads. */
if (self == __pthread_main_thread) {
-#ifdef USE_TLS
+#if defined(USE_TLS) && USE_TLS
waitpid(__pthread_manager_thread->p_pid, NULL, __WCLONE);
#else
waitpid(__pthread_manager_thread.p_pid, NULL, __WCLONE);
size_t offset __attribute__ ((unused)),
void **address __attribute__ ((unused)))
{
-#ifdef USE_TLS
+#if defined(USE_TLS) && USE_TLS
size_t modid;
union dtv pdtv, *dtvp;