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.gu...@st.com>
Signed-off-by: Christophe Lyon <christophe.l...@st.com>

diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c
index 06b0ac8..b335476 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
 
-- 
2.6.3

_______________________________________________
devel mailing list
devel@uclibc-ng.org
https://mailman.uclibc-ng.org/cgi-bin/mailman/listinfo/devel

Reply via email to