diff options
author | Christophe Lyon <christophe.lyon@st.com> | 2018-07-04 17:55:29 +0200 |
---|---|---|
committer | Waldemar Brodkorb <wbrodkorb@conet.de> | 2018-08-10 16:02:45 +0200 |
commit | 69634db9348550f573141f478cb78eaa8363f16a (patch) | |
tree | 39125766da9e938a4173a744d5db730bac531914 | |
parent | f81c99217f0ba491fc013ee89436aa0503dab257 (diff) |
rtld: Use ELF_RTYPE_CLASS_DLSYM
rtld must call _dl_find_hash() with ELF_RTYPE_CLASS_DLSYM since we
want a function descriptor.
* ldso/ldso/ldso.c (_dl_get_ready_to_run): Support __FDPIC__.
Signed-off-by: Mickaël Guêné <mickael.guene@st.com>
Signed-off-by: Christophe Lyon <christophe.lyon@st.com>
-rw-r--r-- | ldso/ldso/ldso.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c index 06b0ac874..b33547670 100644 --- a/ldso/ldso/ldso.c +++ b/ldso/ldso/ldso.c @@ -444,6 +444,11 @@ void *_dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr, size_t relro_size = 0; struct r_scope_elem *global_scope; struct elf_resolve **local_scope; +#if defined(__FDPIC__) + int rtype_class = ELF_RTYPE_CLASS_DLSYM; +#else + int rtype_class = ELF_RTYPE_CLASS_PLT; +#endif #if defined(USE_TLS) && USE_TLS void *tcbp = NULL; @@ -1422,21 +1427,21 @@ of this helper program; chances are you did not intend to run this program.\n\ /* Find the real malloc function and make ldso functions use that from now on */ _dl_malloc_function = (void* (*)(size_t)) (intptr_t) _dl_find_hash(__C_SYMBOL_PREFIX__ "malloc", - global_scope, NULL, ELF_RTYPE_CLASS_PLT, NULL); + global_scope, NULL, rtype_class, NULL); #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", global_scope, NULL, ELF_RTYPE_CLASS_PLT, NULL); + _dl_find_hash(__C_SYMBOL_PREFIX__ "calloc", global_scope, NULL, rtype_class, NULL); _dl_realloc_function = (void* (*)(void *, size_t)) (intptr_t) - _dl_find_hash(__C_SYMBOL_PREFIX__ "realloc", global_scope, NULL, ELF_RTYPE_CLASS_PLT, NULL); + _dl_find_hash(__C_SYMBOL_PREFIX__ "realloc", global_scope, NULL, rtype_class, NULL); _dl_free_function = (void (*)(void *)) (intptr_t) - _dl_find_hash(__C_SYMBOL_PREFIX__ "free", global_scope, NULL, ELF_RTYPE_CLASS_PLT, NULL); + _dl_find_hash(__C_SYMBOL_PREFIX__ "free", global_scope, NULL, rtype_class, NULL); _dl_memalign_function = (void* (*)(size_t, size_t)) (intptr_t) - _dl_find_hash(__C_SYMBOL_PREFIX__ "memalign", global_scope, NULL, ELF_RTYPE_CLASS_PLT, NULL); + _dl_find_hash(__C_SYMBOL_PREFIX__ "memalign", global_scope, NULL, rtype_class, NULL); #endif |