[uClibc-cvs] CVS uClibc/ldso/ldso
CVS User jocke
jocke at codepoet.org
Wed Nov 10 15:27:11 UTC 2004
Update of /var/cvs/uClibc/ldso/ldso
In directory nail:/tmp/cvs-serv473/ldso
Modified Files:
dl-hash.c ldso.c
Log Message:
Add RTLD_LOCAL support for dlopened libs. Reported by
Andrew de Quincey, who has been most helpful getting this sorted
out, thanks. Thanks also to Peter Mazinger who did alot of testing.
Removed all traces of dl_parse_copy_information() since it is no longer used.
--- /var/cvs/uClibc/ldso/ldso/dl-hash.c 2004/11/02 08:14:45 1.25
+++ /var/cvs/uClibc/ldso/ldso/dl-hash.c 2004/11/10 15:27:10 1.26
@@ -137,7 +137,7 @@
* This function resolves externals, and this is either called when we process
* relocations or when we call an entry in the PLT table for the first time.
*/
-char *_dl_find_hash(const char *name, struct dyn_elf *rpnt, int type_class)
+char *_dl_find_hash(const char *name, struct dyn_elf *rpnt, struct elf_resolve *mytpnt, int type_class)
{
struct elf_resolve *tpnt;
int si;
@@ -148,17 +148,24 @@
char *weak_result = NULL;
elf_hash_number = _dl_elf_hash(name);
-
- /*
- NOTE! RTLD_LOCAL handling for dlopen not implemented yet.
- Everything is treated as RTLD_GLOBAL.
- */
for (; rpnt; rpnt = rpnt->next) {
tpnt = rpnt->dyn;
- if (!(tpnt->rtld_flags & RTLD_GLOBAL))
- continue;
+ if (!(tpnt->rtld_flags & RTLD_GLOBAL) && mytpnt) {
+ if (mytpnt == tpnt)
+ ;
+ else {
+ struct init_fini_list *tmp;
+
+ for (tmp = mytpnt->rtld_local; tmp; tmp = tmp->next) {
+ if (tmp->tpnt == tpnt)
+ break;
+ }
+ if (!tmp)
+ continue;
+ }
+ }
/* Don't search the executable when resolving a copy reloc. */
if ((type_class & ELF_RTYPE_CLASS_COPY) && tpnt->libtype == elf_executable)
continue;
--- /var/cvs/uClibc/ldso/ldso/ldso.c 2004/11/02 08:14:45 1.127
+++ /var/cvs/uClibc/ldso/ldso/ldso.c 2004/11/10 15:27:11 1.128
@@ -774,7 +774,7 @@
* ld.so.1, so we have to look up each symbol individually.
*/
- _dl_envp = (unsigned long *) (intptr_t) _dl_find_hash("__environ", _dl_symbol_tables, 0);
+ _dl_envp = (unsigned long *) (intptr_t) _dl_find_hash("__environ", _dl_symbol_tables, NULL, 0);
if (_dl_envp)
*_dl_envp = (unsigned long) envp;
@@ -798,10 +798,10 @@
}
#endif
- _dl_atexit = (int (*)(void *)) (intptr_t) _dl_find_hash("atexit", _dl_symbol_tables, ELF_RTYPE_CLASS_PLT);
+ _dl_atexit = (int (*)(void *)) (intptr_t) _dl_find_hash("atexit", _dl_symbol_tables, NULL, ELF_RTYPE_CLASS_PLT);
#if defined (__SUPPORT_LD_DEBUG__)
_dl_on_exit = (int (*)(void (*)(int, void *),void*))
- (intptr_t) _dl_find_hash("on_exit", _dl_symbol_tables, ELF_RTYPE_CLASS_PLT);
+ (intptr_t) _dl_find_hash("on_exit", _dl_symbol_tables, NULL, ELF_RTYPE_CLASS_PLT);
#endif
/* Notify the debugger we have added some objects. */
@@ -853,7 +853,7 @@
_dl_debug_state();
/* 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("malloc", _dl_symbol_tables, ELF_RTYPE_CLASS_PLT);
+ _dl_malloc_function = (void* (*)(size_t)) (intptr_t) _dl_find_hash("malloc", _dl_symbol_tables, NULL, ELF_RTYPE_CLASS_PLT);
}
char *_dl_getenv(const char *symbol, char **envp)
More information about the uClibc-cvs
mailing list