summaryrefslogtreecommitdiff
path: root/ldso
diff options
context:
space:
mode:
Diffstat (limited to 'ldso')
-rw-r--r--ldso/ldso/dl-elf.c37
-rw-r--r--ldso/ldso/linuxelf.h2
-rw-r--r--ldso/ldso/readelflib1.c37
-rw-r--r--ldso/libdl/dlib.c4
-rw-r--r--ldso/libdl/libdl.c4
5 files changed, 43 insertions, 41 deletions
diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c
index 4422a46a0..c5e7607e0 100644
--- a/ldso/ldso/dl-elf.c
+++ b/ldso/ldso/dl-elf.c
@@ -141,7 +141,7 @@ search_for_named_library(char *name, int secure, const char *path_list,
_dl_strcat(mylibname, "/");
_dl_strcat(mylibname, name);
if ((tpnt1 = _dl_load_elf_shared_library(secure, rpnt,
- mylibname, 0)) != NULL)
+ mylibname)) != NULL)
{
return tpnt1;
}
@@ -188,7 +188,7 @@ struct elf_resolve *_dl_load_shared_library(int secure, struct dyn_elf **rpnt,
/usr/i486-sysv4/lib for /usr/lib in library names. */
if (libname != full_libname) {
- tpnt1 = _dl_load_elf_shared_library(secure, rpnt, full_libname, 0);
+ tpnt1 = _dl_load_elf_shared_library(secure, rpnt, full_libname);
if (tpnt1)
return tpnt1;
goto goof;
@@ -243,7 +243,7 @@ struct elf_resolve *_dl_load_shared_library(int secure, struct dyn_elf **rpnt,
libent[i].flags == LIB_ELF_LIBC5) &&
_dl_strcmp(libname, strs + libent[i].sooffset) == 0 &&
(tpnt1 = _dl_load_elf_shared_library(secure,
- rpnt, strs + libent[i].liboffset, 0)))
+ rpnt, strs + libent[i].liboffset)))
return tpnt1;
}
}
@@ -297,7 +297,7 @@ goof:
*/
struct elf_resolve *_dl_load_elf_shared_library(int secure,
- struct dyn_elf **rpnt, char *libname, int flag)
+ struct dyn_elf **rpnt, char *libname)
{
elfhdr *epnt;
unsigned long dynamic_addr = 0;
@@ -319,14 +319,16 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
/* If this file is already loaded, skip this step */
tpnt = _dl_check_hashed_files(libname);
if (tpnt) {
- (*rpnt)->next = (struct dyn_elf *)
- _dl_malloc(sizeof(struct dyn_elf));
- _dl_memset((*rpnt)->next, 0, sizeof(*((*rpnt)->next)));
- *rpnt = (*rpnt)->next;
+ if (*rpnt) {
+ (*rpnt)->next = (struct dyn_elf *)
+ _dl_malloc(sizeof(struct dyn_elf));
+ _dl_memset((*rpnt)->next, 0, sizeof(*((*rpnt)->next)));
+ *rpnt = (*rpnt)->next;
+ (*rpnt)->dyn = tpnt;
+ tpnt->symbol_scope = _dl_symbol_tables;
+ }
tpnt->usage_count++;
- tpnt->symbol_scope = _dl_symbol_tables;
tpnt->libtype = elf_lib;
- (*rpnt)->dyn = tpnt;
return tpnt;
}
@@ -565,7 +567,6 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
}
}
-
tpnt = _dl_add_elf_hash_table(libname, (char *) libaddr, dynamic_info,
dynamic_addr, dynamic_size);
@@ -575,14 +576,16 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
/*
* Add this object into the symbol chain
*/
- (*rpnt)->next = (struct dyn_elf *)
- _dl_malloc(sizeof(struct dyn_elf));
- _dl_memset((*rpnt)->next, 0, sizeof(*((*rpnt)->next)));
- *rpnt = (*rpnt)->next;
+ if (*rpnt) {
+ (*rpnt)->next = (struct dyn_elf *)
+ _dl_malloc(sizeof(struct dyn_elf));
+ _dl_memset((*rpnt)->next, 0, sizeof(*((*rpnt)->next)));
+ *rpnt = (*rpnt)->next;
+ (*rpnt)->dyn = tpnt;
+ tpnt->symbol_scope = _dl_symbol_tables;
+ }
tpnt->usage_count++;
- tpnt->symbol_scope = _dl_symbol_tables;
tpnt->libtype = elf_lib;
- (*rpnt)->dyn = tpnt;
/*
* OK, the next thing we need to do is to insert the dynamic linker into
diff --git a/ldso/ldso/linuxelf.h b/ldso/ldso/linuxelf.h
index a1c9903d0..5a6e8b85f 100644
--- a/ldso/ldso/linuxelf.h
+++ b/ldso/ldso/linuxelf.h
@@ -25,7 +25,7 @@ extern int _dl_parse_relocation_information(struct elf_resolve *tpnt,
extern struct elf_resolve * _dl_load_shared_library(int secure,
struct dyn_elf **rpnt, struct elf_resolve *tpnt, char *full_libname);
extern struct elf_resolve * _dl_load_elf_shared_library(int secure,
- struct dyn_elf **rpnt, char *libname, int flag);
+ struct dyn_elf **rpnt, char *libname);
extern int _dl_linux_resolve(void);
#define ELF_CLASS ELFCLASS32
diff --git a/ldso/ldso/readelflib1.c b/ldso/ldso/readelflib1.c
index 4422a46a0..c5e7607e0 100644
--- a/ldso/ldso/readelflib1.c
+++ b/ldso/ldso/readelflib1.c
@@ -141,7 +141,7 @@ search_for_named_library(char *name, int secure, const char *path_list,
_dl_strcat(mylibname, "/");
_dl_strcat(mylibname, name);
if ((tpnt1 = _dl_load_elf_shared_library(secure, rpnt,
- mylibname, 0)) != NULL)
+ mylibname)) != NULL)
{
return tpnt1;
}
@@ -188,7 +188,7 @@ struct elf_resolve *_dl_load_shared_library(int secure, struct dyn_elf **rpnt,
/usr/i486-sysv4/lib for /usr/lib in library names. */
if (libname != full_libname) {
- tpnt1 = _dl_load_elf_shared_library(secure, rpnt, full_libname, 0);
+ tpnt1 = _dl_load_elf_shared_library(secure, rpnt, full_libname);
if (tpnt1)
return tpnt1;
goto goof;
@@ -243,7 +243,7 @@ struct elf_resolve *_dl_load_shared_library(int secure, struct dyn_elf **rpnt,
libent[i].flags == LIB_ELF_LIBC5) &&
_dl_strcmp(libname, strs + libent[i].sooffset) == 0 &&
(tpnt1 = _dl_load_elf_shared_library(secure,
- rpnt, strs + libent[i].liboffset, 0)))
+ rpnt, strs + libent[i].liboffset)))
return tpnt1;
}
}
@@ -297,7 +297,7 @@ goof:
*/
struct elf_resolve *_dl_load_elf_shared_library(int secure,
- struct dyn_elf **rpnt, char *libname, int flag)
+ struct dyn_elf **rpnt, char *libname)
{
elfhdr *epnt;
unsigned long dynamic_addr = 0;
@@ -319,14 +319,16 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
/* If this file is already loaded, skip this step */
tpnt = _dl_check_hashed_files(libname);
if (tpnt) {
- (*rpnt)->next = (struct dyn_elf *)
- _dl_malloc(sizeof(struct dyn_elf));
- _dl_memset((*rpnt)->next, 0, sizeof(*((*rpnt)->next)));
- *rpnt = (*rpnt)->next;
+ if (*rpnt) {
+ (*rpnt)->next = (struct dyn_elf *)
+ _dl_malloc(sizeof(struct dyn_elf));
+ _dl_memset((*rpnt)->next, 0, sizeof(*((*rpnt)->next)));
+ *rpnt = (*rpnt)->next;
+ (*rpnt)->dyn = tpnt;
+ tpnt->symbol_scope = _dl_symbol_tables;
+ }
tpnt->usage_count++;
- tpnt->symbol_scope = _dl_symbol_tables;
tpnt->libtype = elf_lib;
- (*rpnt)->dyn = tpnt;
return tpnt;
}
@@ -565,7 +567,6 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
}
}
-
tpnt = _dl_add_elf_hash_table(libname, (char *) libaddr, dynamic_info,
dynamic_addr, dynamic_size);
@@ -575,14 +576,16 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
/*
* Add this object into the symbol chain
*/
- (*rpnt)->next = (struct dyn_elf *)
- _dl_malloc(sizeof(struct dyn_elf));
- _dl_memset((*rpnt)->next, 0, sizeof(*((*rpnt)->next)));
- *rpnt = (*rpnt)->next;
+ if (*rpnt) {
+ (*rpnt)->next = (struct dyn_elf *)
+ _dl_malloc(sizeof(struct dyn_elf));
+ _dl_memset((*rpnt)->next, 0, sizeof(*((*rpnt)->next)));
+ *rpnt = (*rpnt)->next;
+ (*rpnt)->dyn = tpnt;
+ tpnt->symbol_scope = _dl_symbol_tables;
+ }
tpnt->usage_count++;
- tpnt->symbol_scope = _dl_symbol_tables;
tpnt->libtype = elf_lib;
- (*rpnt)->dyn = tpnt;
/*
* OK, the next thing we need to do is to insert the dynamic linker into
diff --git a/ldso/libdl/dlib.c b/ldso/libdl/dlib.c
index 5140ae28d..82ec50943 100644
--- a/ldso/libdl/dlib.c
+++ b/ldso/libdl/dlib.c
@@ -68,7 +68,7 @@ static void dl_cleanup(void)
void *_dlopen(const char *libname, int flag)
{
struct elf_resolve *tpnt, *tfrom;
- struct dyn_elf *rpnt;
+ struct dyn_elf *rpnt = NULL;
struct dyn_elf *dyn_chain;
struct dyn_elf *dpnt;
static int dl_init = 0;
@@ -115,7 +115,6 @@ void *_dlopen(const char *libname, int flag)
return NULL;
}
- tpnt->usage_count++;
dyn_chain = rpnt = (struct dyn_elf *) malloc(sizeof(struct dyn_elf));
_dl_memset(rpnt, 0, sizeof(*rpnt));
rpnt->dyn = tpnt;
@@ -151,7 +150,6 @@ void *_dlopen(const char *libname, int flag)
rpnt->next = (struct dyn_elf *) malloc(sizeof(struct dyn_elf));
_dl_memset (rpnt->next, 0, sizeof (*(rpnt->next)));
rpnt = rpnt->next;
- tpnt1->usage_count++;
if (!tpnt1->symbol_scope) tpnt1->symbol_scope = dyn_chain;
rpnt->dyn = tpnt1;
};
diff --git a/ldso/libdl/libdl.c b/ldso/libdl/libdl.c
index 5140ae28d..82ec50943 100644
--- a/ldso/libdl/libdl.c
+++ b/ldso/libdl/libdl.c
@@ -68,7 +68,7 @@ static void dl_cleanup(void)
void *_dlopen(const char *libname, int flag)
{
struct elf_resolve *tpnt, *tfrom;
- struct dyn_elf *rpnt;
+ struct dyn_elf *rpnt = NULL;
struct dyn_elf *dyn_chain;
struct dyn_elf *dpnt;
static int dl_init = 0;
@@ -115,7 +115,6 @@ void *_dlopen(const char *libname, int flag)
return NULL;
}
- tpnt->usage_count++;
dyn_chain = rpnt = (struct dyn_elf *) malloc(sizeof(struct dyn_elf));
_dl_memset(rpnt, 0, sizeof(*rpnt));
rpnt->dyn = tpnt;
@@ -151,7 +150,6 @@ void *_dlopen(const char *libname, int flag)
rpnt->next = (struct dyn_elf *) malloc(sizeof(struct dyn_elf));
_dl_memset (rpnt->next, 0, sizeof (*(rpnt->next)));
rpnt = rpnt->next;
- tpnt1->usage_count++;
if (!tpnt1->symbol_scope) tpnt1->symbol_scope = dyn_chain;
rpnt->dyn = tpnt1;
};