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/libdl/libdl.c | |
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/libdl/libdl.c')
-rw-r--r-- | ldso/libdl/libdl.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/ldso/libdl/libdl.c b/ldso/libdl/libdl.c index 22b622d28..05a68ddcc 100644 --- a/ldso/libdl/libdl.c +++ b/ldso/libdl/libdl.c @@ -39,14 +39,14 @@ #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 @@ -112,7 +112,7 @@ struct r_debug *_dl_debug_addr = NULL; #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). @@ -166,7 +166,7 @@ static const char *const dl_error_names[] = { }; -#if USE_TLS +#if defined(USE_TLS) && USE_TLS #ifdef SHARED /* * Systems which do not have tls_index also probably have to define @@ -284,7 +284,7 @@ void *dlopen(const char *libname, int flag) 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 @@ -519,7 +519,7 @@ void *dlopen(const char *libname, int flag) /* 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]; @@ -670,7 +670,7 @@ void *dlsym(void *vhandle, const char *name) 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. */ @@ -709,7 +709,7 @@ static int do_dlclose(void *vhandle, int need_fini) 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; @@ -771,7 +771,7 @@ static int do_dlclose(void *vhandle, int need_fini) 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; @@ -924,7 +924,7 @@ static int do_dlclose(void *vhandle, int need_fini) 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)) { |