|
@@ -607,9 +607,19 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
|
|
_dl_memset((*rpnt)->next, 0, sizeof(struct dyn_elf));
|
|
_dl_memset((*rpnt)->next, 0, sizeof(struct dyn_elf));
|
|
(*rpnt)->next->prev = (*rpnt);
|
|
(*rpnt)->next->prev = (*rpnt);
|
|
*rpnt = (*rpnt)->next;
|
|
*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->usage_count++;
|
|
tpnt->libtype = elf_lib;
|
|
tpnt->libtype = elf_lib;
|
|
|
|
|