aboutsummaryrefslogtreecommitdiff
path: root/elf/dl-load.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1995-09-30 21:18:30 +0000
committerRoland McGrath <roland@gnu.org>1995-09-30 21:18:30 +0000
commit879bf2e65a9ddaea34fe0428ab0f71caca4b4d00 (patch)
tree7bfc6325a784f1f65f7cd527f1b1be6f2ff1a456 /elf/dl-load.c
parent41cfadd63c6d28400f263460e3f2b15e74893b63 (diff)
downloadglibc-879bf2e65a9ddaea34fe0428ab0f71caca4b4d00.zip
glibc-879bf2e65a9ddaea34fe0428ab0f71caca4b4d00.tar.gz
glibc-879bf2e65a9ddaea34fe0428ab0f71caca4b4d00.tar.bz2
* sysdeps/mach/hurd/dl-sysdep.c (_dl_sysdep_start): If started by
kernel with args on stack, point _dl_hurd_data at zero data instead of garbage. When ld.so run as program, grok args -LIB=MEMOBJ and pre-load shared object files found in memory objects loaded by the boot loader. * elf/link.h (struct link_map): New member `l_entry'. (_dl_map_object, _dl_map_object_from_fd): Remove last arg ENTRY_POINT. * elf/dl-load.c (_dl_map_object, _dl_map_object_from_fd): Remove last arg ENTRY_POINT. Store the entry point location in the `l_entry' member of the new map. * elf/rtld.c (dl_main): Don't pass USER_ENTRY arg to _dl_map_object. When run as program, set *USER_ENTRY to L->l_entry. * elf/dl-init.c (_dl_init_next): Don't pass ENTRY_POINT arg to _dl_map_object.
Diffstat (limited to 'elf/dl-load.c')
-rw-r--r--elf/dl-load.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 7319602..12b945a 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -104,8 +104,7 @@ open_path (const char *name, size_t namelen,
/* Map in the shared object file NAME. */
struct link_map *
-_dl_map_object (struct link_map *loader, const char *name,
- Elf32_Addr *entry_point)
+_dl_map_object (struct link_map *loader, const char *name)
{
int fd;
char *realname;
@@ -152,7 +151,7 @@ _dl_map_object (struct link_map *loader, const char *name,
if (fd == -1)
_dl_signal_error (errno, name, "cannot open shared object file");
- return _dl_map_object_from_fd (name, fd, realname, entry_point);
+ return _dl_map_object_from_fd (name, fd, realname);
}
@@ -160,8 +159,7 @@ _dl_map_object (struct link_map *loader, const char *name,
opened on FD. */
struct link_map *
-_dl_map_object_from_fd (const char *name, int fd, char *realname,
- Elf32_Addr *entry_point)
+_dl_map_object_from_fd (const char *name, int fd, char *realname)
{
struct link_map *l = NULL;
const size_t pagesize = getpagesize ();
@@ -249,17 +247,16 @@ _dl_map_object_from_fd (const char *name, int fd, char *realname,
the headers. */
Elf32_Phdr phdr[header->e_phnum];
const Elf32_Phdr *ph;
- int anywhere;
+ int anywhere, type;
+
+ type = header->e_type;
+ anywhere = type == ET_DYN || type == ET_REL;
+ l->l_entry = header->e_entry;
ph = map (header->e_phoff, header->e_phnum * sizeof (Elf32_Phdr));
memcpy (phdr, ph, sizeof phdr);
l->l_phnum = header->e_phnum;
- anywhere = header->e_type == ET_DYN || header->e_type == ET_REL;
-
- if (entry_point)
- *entry_point = header->e_entry;
-
/* We are done reading the file's headers now. Unmap them. */
munmap (file_mapping, mapping_size);
@@ -375,12 +372,18 @@ _dl_map_object_from_fd (const char *name, int fd, char *realname,
}
if (l->l_ld == 0)
- LOSE ("object file has no dynamic section");
- (Elf32_Addr) l->l_ld += l->l_addr;
+ {
+ if (type == ET_DYN)
+ LOSE ("object file has no dynamic section");
+ }
+ else
+ (Elf32_Addr) l->l_ld += l->l_addr;
if (l->l_phdr == 0)
l->l_phdr = (void *) ((const Elf32_Ehdr *) l->l_addr)->e_phoff;
(Elf32_Addr) l->l_phdr += l->l_addr;
+
+ l->l_entry += l->l_addr;
}
elf_get_dynamic_info (l->l_ld, l->l_info);