From a2e1b046f6891ac76830353f7afc97b0c6d27a64 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Sun, 7 Jan 1996 10:00:21 +0000 Subject: Sat Jan 6 16:39:14 1996 Roland McGrath * 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. --- elf/dynamic-link.h | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'elf/dynamic-link.h') diff --git a/elf/dynamic-link.h b/elf/dynamic-link.h index 84d440ec5b..0c4e99d2b6 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. */ -- cgit 1.4.1