diff options
author | Joakim Tjernlund <joakim.tjernlund@transmode.se> | 2007-02-16 18:02:50 +0000 |
---|---|---|
committer | Joakim Tjernlund <joakim.tjernlund@transmode.se> | 2007-02-16 18:02:50 +0000 |
commit | 2244c71124b3a33cbb065e524dbdc0662099d7c2 (patch) | |
tree | 44df319ac23e64f2809a652c8d8fe93c0db73106 /ldso | |
parent | 72fc4ba5e7ab55dd2752ce0f38a405a480f6ee4c (diff) |
Fix dlopen for static apps.
From Carmelo Amoroso.
Diffstat (limited to 'ldso')
-rw-r--r-- | ldso/ldso/dl-elf.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c index 31dd75729..e67257e18 100644 --- a/ldso/ldso/dl-elf.c +++ b/ldso/ldso/dl-elf.c @@ -607,9 +607,19 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure, _dl_memset((*rpnt)->next, 0, sizeof(struct dyn_elf)); (*rpnt)->next->prev = (*rpnt); *rpnt = (*rpnt)->next; - (*rpnt)->dyn = tpnt; - tpnt->symbol_scope = _dl_symbol_tables; } +#ifndef SHARED + /* When statically linked, the first time we dlopen a DSO + * the *rpnt is NULL, so we need to allocate memory for it, + * and initialize the _dl_symbol_table. + */ + else { + *rpnt = _dl_symbol_tables = (struct dyn_elf *) _dl_malloc(sizeof(struct dyn_elf)); + _dl_memset(*rpnt, 0, sizeof(struct dyn_elf)); + } +#endif + (*rpnt)->dyn = tpnt; + tpnt->symbol_scope = _dl_symbol_tables; tpnt->usage_count++; tpnt->libtype = elf_lib; |