about summary refs log tree commit diff
path: root/elf/dl-load.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-02-08 10:08:45 +0000
committerUlrich Drepper <drepper@redhat.com>1999-02-08 10:08:45 +0000
commit82d0c09944e0fa5d22700337b9a8e1c7ae17ea55 (patch)
treee25ba529d6be1baa38b943be642888553873d3f4 /elf/dl-load.c
parentc18cec57b935f80f2d23a3e8d779373fdd932a8b (diff)
downloadglibc-82d0c09944e0fa5d22700337b9a8e1c7ae17ea55.tar.gz
glibc-82d0c09944e0fa5d22700337b9a8e1c7ae17ea55.tar.xz
glibc-82d0c09944e0fa5d22700337b9a8e1c7ae17ea55.zip
Update.
	* po/el.po: New file.

1999-02-07  Andreas Schwab  <schwab@issan.cs.uni-dortmund.de>

	* elf/dl-load.c (_dl_map_object_from_fd): Replace magic constant
	when processing DT_SYMBOLIC objects.

1999-02-07  Andreas Schwab  <schwab@issan.cs.uni-dortmund.de>

	* elf/dl-load.c (_dl_map_object_from_fd): When looking for the
	program headers without PT_PHDR only require that they are
	contained within one of the loaded segments.  Don't use assert,
	since that would be a bug in the object, not the dynamic linker.

1999-02-08  Richard Henderson  <rth@cygnus.com>

	* sysdeps/alpha/dl-machine.h (TRAMPOLINE_TEMPLATE): Save and
	restore all call-clobbered fp regs.

1999-02-08  Ulrich Drepper  <drepper@cygnus.com>
Diffstat (limited to 'elf/dl-load.c')
-rw-r--r--elf/dl-load.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 07ac359739..84951ea00f 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -864,11 +864,18 @@ _dl_map_object_from_fd (const char *name, int fd, char *realname,
       {
 	/* There was no PT_PHDR specified.  We need to find the phdr in the
            load image ourselves.  We assume it is in fact in the load image
-           somewhere, and that the first load command starts at the
-           beginning of the file and thus contains the ELF file header.  */
-	ElfW(Addr) bof = l->l_addr + loadcmds[0].mapstart;
-	assert (loadcmds[0].mapoff == 0);
-	l->l_phdr = (void *) (bof + ((const ElfW(Ehdr) *) bof)->e_phoff);
+           somewhere.  */
+	for (c = loadcmds; c < &loadcmds[nloadcmds]; c++)
+	  if (c->mapoff <= header->e_phoff
+	      && (c->mapend - c->mapstart + c->mapoff
+		  >= header->e_phoff + header->e_phnum * sizeof (ElfW(Phdr))))
+	    {
+	      ElfW(Addr) bof = l->l_addr + c->mapstart;
+	      l->l_phdr = (void *) (bof + header->e_phoff - c->mapoff);
+	      break;
+	    }
+	if (l->l_phdr == 0)
+	  LOSE ("program headers not contained in any loaded segment");
       }
     else
       /* Adjust the PT_PHDR value by the runtime load address.  */
@@ -948,7 +955,7 @@ _dl_map_object_from_fd (const char *name, int fd, char *realname,
 
       /* Now move the existing entries one back.  */
       memmove (&l->l_scope[1], &l->l_scope[0],
-	       3 * sizeof (struct r_scope_elem *));
+	       sizeof (l->l_scope) - sizeof (l->l_scope[0]));
 
       /* Now add the new entry.  */
       l->l_scope[0] = &l->l_symbolic_searchlist;