aboutsummaryrefslogtreecommitdiff
path: root/elf
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1996-01-07 10:00:21 +0000
committerRoland McGrath <roland@gnu.org>1996-01-07 10:00:21 +0000
commita2e1b046f6891ac76830353f7afc97b0c6d27a64 (patch)
tree4bc169458c918fe9a19aa2946de81ced9ade1124 /elf
parentc4b7291877252d1a0b2e2afbc90bab7fe6965a38 (diff)
downloadglibc-a2e1b046f6891ac76830353f7afc97b0c6d27a64.zip
glibc-a2e1b046f6891ac76830353f7afc97b0c6d27a64.tar.gz
glibc-a2e1b046f6891ac76830353f7afc97b0c6d27a64.tar.bz2
Sat Jan 6 16:39:14 1996 Roland McGrath <roland@churchy.gnu.ai.mit.edu>cvs/libc-960108cvs/libc-960107
* Makefile (subdirs): Added db. * resolv/Makefile (routines): Add res_data. * resolv/res_data.c, resolv/res_debug.c, resolv/resolv.h: Updated from BIND 4.9.3 final release. * elf/dynamic-link.h (elf_get_dynamic_info): Handle processor-specific tags. (ELF_DYNAMIC_DO_REL, ELF_DYNAMIC_DO_RELA): Handle absent DT_PLTREL tag. * elf/elf.h (DT_MIPS_NUM, DT_PROCNUM): New macros. * elf/link.h (struct link_map): Extend `l_info' by DT_PROCNUM. * sysdeps/i386/dl-machine.h (elf_machine_runtime_setup): Take new arg LAZY. Only do our work if LAZY and there is a DT_JMPREL record. * elf/dl-reloc.c (_dl_relocate_object): Call elf_machine_runtime_setup unconditionally, and pass it LAZY flag. * elf/dl-load.c: Fixed ELFMAG check to work for either byte order. Align end of load segment only to page size, not to segment alignment.
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-reloc.c9
-rw-r--r--elf/dynamic-link.h20
-rw-r--r--elf/elf.h6
-rw-r--r--elf/link.h9
4 files changed, 28 insertions, 16 deletions
diff --git a/elf/dl-reloc.c b/elf/dl-reloc.c
index 7e4f499..b7d484d 100644
--- a/elf/dl-reloc.c
+++ b/elf/dl-reloc.c
@@ -1,5 +1,5 @@
/* Relocate a shared object and resolve its references to other loaded objects.
-Copyright (C) 1995 Free Software Foundation, Inc.
+Copyright (C) 1995, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -93,10 +93,9 @@ _dl_relocate_object (struct link_map *l, int lazy)
l->l_prev->l_next = l;
}
- if (l->l_info[DT_JMPREL] && lazy)
- /* Set up the PLT so its unrelocated entries will
- jump to _dl_runtime_resolve, which will relocate them. */
- elf_machine_runtime_setup (l);
+ /* Set up the PLT so its unrelocated entries will
+ jump to _dl_runtime_resolve, which will relocate them. */
+ elf_machine_runtime_setup (l, lazy);
l->l_relocated = 1;
diff --git a/elf/dynamic-link.h b/elf/dynamic-link.h
index 84d440e..0c4e99d 100644
--- a/elf/dynamic-link.h
+++ b/elf/dynamic-link.h
@@ -25,11 +25,11 @@ Cambridge, MA 02139, USA. */
/* Read the dynamic section at DYN and fill in INFO with indices DT_*. */
static inline void
-elf_get_dynamic_info (Elf32_Dyn *dyn, Elf32_Dyn *info[DT_NUM])
+elf_get_dynamic_info (Elf32_Dyn *dyn, Elf32_Dyn *info[DT_NUM + DT_PROCNUM])
{
unsigned int i;
- for (i = 0; i < DT_NUM; ++i)
+ for (i = 0; i < DT_NUM + DT_PROCNUM; ++i)
info[i] = NULL;
if (! dyn)
@@ -37,8 +37,14 @@ elf_get_dynamic_info (Elf32_Dyn *dyn, Elf32_Dyn *info[DT_NUM])
while (dyn->d_tag != DT_NULL)
{
- assert (dyn->d_tag < DT_NUM);
- info[dyn->d_tag] = dyn++;
+ if (dyn->d_tag < DT_NUM)
+ info[dyn->d_tag] = dyn;
+ else if (dyn->d_tag >= DT_LOPROC &&
+ dyn->d_tag < DT_LOPROC + DT_PROCNUM)
+ info[dyn->d_tag - DT_LOPROC + DT_NUM] = dyn;
+ else
+ assert (! "bad dynamic tag");
+ dyn++;
}
if (info[DT_RELA])
@@ -60,7 +66,8 @@ elf_get_dynamic_info (Elf32_Dyn *dyn, Elf32_Dyn *info[DT_NUM])
#define ELF_DYNAMIC_DO_REL(map, lazy, resolve) \
if ((map)->l_info[DT_REL]) \
elf_dynamic_do_rel ((map), DT_REL, DT_RELSZ, (resolve), 0); \
- if ((map)->l_info[DT_PLTREL]->d_un.d_val == DT_REL) \
+ if ((map)->l_info[DT_PLTREL] && \
+ (map)->l_info[DT_PLTREL]->d_un.d_val == DT_REL) \
elf_dynamic_do_rel ((map), DT_JMPREL, DT_PLTRELSZ, (resolve), (lazy));
#else
#define ELF_DYNAMIC_DO_RELA(map, lazy, resolve) /* Nothing to do. */
@@ -72,7 +79,8 @@ elf_get_dynamic_info (Elf32_Dyn *dyn, Elf32_Dyn *info[DT_NUM])
#define ELF_DYNAMIC_DO_RELA(map, lazy, resolve) \
if ((map)->l_info[DT_RELA]) \
elf_dynamic_do_rela ((map), DT_RELA, DT_RELASZ, (resolve), 0); \
- if ((map)->l_info[DT_PLTREL]->d_un.d_val == DT_RELA) \
+ if ((map)->l_info[DT_PLTREL] && \
+ (map)->l_info[DT_PLTREL]->d_un.d_val == DT_RELA) \
elf_dynamic_do_rela ((map), DT_JMPREL, DT_PLTRELSZ, (resolve), (lazy));
#else
#define ELF_DYNAMIC_DO_RELA(map, lazy, resolve) /* Nothing to do. */
diff --git a/elf/elf.h b/elf/elf.h
index 85c992c..6eaf31f 100644
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -1,5 +1,5 @@
/* This file defines standard ELF types, structures, and macros.
-Copyright (C) 1995 Free Software Foundation, Inc.
+Copyright (C) 1995, 1996 Free Software Foundation, Inc.
Contributed by Ian Lance Taylor (ian@cygnus.com).
This file is part of the GNU C Library.
@@ -326,9 +326,10 @@ typedef struct
#define DT_DEBUG 21 /* For debugging; unspecified */
#define DT_TEXTREL 22 /* Reloc might modify .text */
#define DT_JMPREL 23 /* Address of PLT relocs */
-#define DT_NUM 24 /* Number used. */
+#define DT_NUM 24 /* Number used */
#define DT_LOPROC 0x70000000 /* Start of processor-specific */
#define DT_HIPROC 0x7fffffff /* End of processor-specific */
+#define DT_PROCNUM DT_MIPS_NUM /* Most used by any processor */
/* Standard 64 bit ELF types. */
@@ -573,6 +574,7 @@ typedef struct
#define DT_MIPS_UNREFEXTNO 0x70000012 /* First external DYNSYM */
#define DT_MIPS_GOTSYM 0x70000013 /* First GOT entry in DYNSYM */
#define DT_MIPS_HIPAGENO 0x70000014 /* Number of GOT page table entries */
+#define DT_MIPS_NUM 0x15
/* Legal values for DT_MIPS_FLAG Elf32_Dyn entry. */
diff --git a/elf/link.h b/elf/link.h
index 4848f4b..bdcfcf2 100644
--- a/elf/link.h
+++ b/elf/link.h
@@ -1,5 +1,5 @@
/* Run-time dynamic linker data structures for loaded ELF shared objects.
-Copyright (C) 1995 Free Software Foundation, Inc.
+Copyright (C) 1995, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -82,7 +82,10 @@ struct link_map
They may change without notice. */
const char *l_libname; /* Name requested (before search). */
- Elf32_Dyn *l_info[DT_NUM]; /* Indexed pointers to dynamic section. */
+ /* Indexed pointers to dynamic section.
+ [0,DT_NUM) are indexed by the processor-independent tags.
+ [DT_NUM,DT_NUM+DT_PROCNUM] are indexed by the tag minus DT_LOPROC. */
+ Elf32_Dyn *l_info[DT_NUM + DT_PROCNUM];
const Elf32_Phdr *l_phdr; /* Pointer to program header table in core. */
Elf32_Word l_phnum; /* Number of program header entries. */
Elf32_Addr l_entry; /* Entry point location. */
@@ -141,7 +144,7 @@ extern int _dl_secure;
zero; OBJECT is the name of the problematical shared object, or null if
it is a general problem; ERRSTRING is a string describing the specific
problem. */
-
+
extern void _dl_signal_error (int errcode,
const char *object,
const char *errstring)