diff options
author | Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com> | 2009-12-16 13:12:00 +0100 |
---|---|---|
committer | Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com> | 2009-12-17 13:42:26 +0100 |
commit | e092e7c30464555b3fb81adc8f2f479e892b0786 (patch) | |
tree | 8aed900855f09f0e93d7808339a01816d5d798a8 /ldso/ldso | |
parent | 197b2de50d7c025b6a25e7e1cde7a5667728c15c (diff) |
check if USE_TLS is defined before use
This patch will convert all the #ifdef USE_TLS and #if USE_TLS to
#if defined(USE_TLS) && USE_TLS.
By checking if the USE_TLS is defined before checking its value will result in
correct behavior for architectures not defining this config symbol.
Signed-off-by: Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com>
Acked-by: Carmelo AMOROSO <carmelo.amoroso@st.com>
Diffstat (limited to 'ldso/ldso')
-rw-r--r-- | ldso/ldso/dl-elf.c | 8 | ||||
-rw-r--r-- | ldso/ldso/dl-hash.c | 4 | ||||
-rw-r--r-- | ldso/ldso/dl-startup.c | 2 | ||||
-rw-r--r-- | ldso/ldso/ldso.c | 18 |
4 files changed, 16 insertions, 16 deletions
diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c index 6bf5bbd6a..a0db63750 100644 --- a/ldso/ldso/dl-elf.c +++ b/ldso/ldso/dl-elf.c @@ -329,7 +329,7 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure, 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; @@ -437,7 +437,7 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure, } } 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; @@ -733,7 +733,7 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure, 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 @@ -875,7 +875,7 @@ int _dl_fixup(struct dyn_elf *rpnt, int now_flag) #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); diff --git a/ldso/ldso/dl-hash.c b/ldso/ldso/dl-hash.c index 6d54f37b9..0048734ba 100644 --- a/ldso/ldso/dl-hash.c +++ b/ldso/ldso/dl-hash.c @@ -158,7 +158,7 @@ static __attribute_noinline__ const ElfW(Sym) * 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 */ @@ -335,7 +335,7 @@ char *_dl_lookup_hash(const char *name, struct dyn_elf *rpnt, struct elf_resolve 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; diff --git a/ldso/ldso/dl-startup.c b/ldso/ldso/dl-startup.c index 91b11dc7f..a51b583a4 100644 --- a/ldso/ldso/dl-startup.c +++ b/ldso/ldso/dl-startup.c @@ -215,7 +215,7 @@ DL_START(unsigned long args) * 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 diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c index bb414b14a..1f5c87a0d 100644 --- a/ldso/ldso/ldso.c +++ b/ldso/ldso/ldso.c @@ -38,7 +38,7 @@ #define ALLOW_ZERO_PLTGOT -#if USE_TLS +#if defined(USE_TLS) && USE_TLS #include "dl-tls.c" #endif @@ -225,7 +225,7 @@ void _dl_free(void *p) (*_dl_free_function) (p); } -#if USE_TLS +#if defined(USE_TLS) && USE_TLS void *_dl_memalign(size_t __boundary, size_t __size) { void *result; @@ -294,7 +294,7 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr, 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 @@ -371,7 +371,7 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr, 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 @@ -504,7 +504,7 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr, /* 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; @@ -531,7 +531,7 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr, 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. @@ -931,7 +931,7 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr, } #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 @@ -971,7 +971,7 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr, _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; @@ -1058,7 +1058,7 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr, _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); |