diff options
author | Roland McGrath <roland@gnu.org> | 1996-06-02 21:35:43 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1996-06-02 21:35:43 +0000 |
commit | 6c03c2cf27b1a12cbf680377e4796b88a20ed9db (patch) | |
tree | b197b18a54a6f15f71e0cd1679f91a25d1d0239f /elf | |
parent | 9004bc202e5ea7b8eabca183f4e6c6abe573f802 (diff) | |
download | glibc-6c03c2cf27b1a12cbf680377e4796b88a20ed9db.tar glibc-6c03c2cf27b1a12cbf680377e4796b88a20ed9db.tar.gz glibc-6c03c2cf27b1a12cbf680377e4796b88a20ed9db.tar.bz2 glibc-6c03c2cf27b1a12cbf680377e4796b88a20ed9db.zip |
* elf/dl-lookup.c (_dl_lookup_symbol): Arg NOSELF renamed to NOPLT.
Reject SHN_UNDEF defns iff NOPLT is nonzero.
* elf/link.h (_dl_lookup_symbol): Update prototype and comment.
* elf/dl-runtime.c (fixup): Pass 1 to _dl_lookup_symbol for NOPLT.
* elf/dlsym.c (dlsym): Pass 0.
* elf/rtld.c (dl_main): Likewise.
* elf/dl-reloc.c (_dl_relocate_object: resolve): Second arg R_OFFSET
replaced with NOPLT flag. Pass it through to _dl_lookup_symbol.
* elf/do-rel.h (elf_dynamic_do_rel): Update prototype of RESOLVE arg.
Pass `elf_machine_pltrel_p (R->r_type)' result as NOPLT flag value.
* sysdeps/i386/dl-machine.h (elf_machine_pltrel_p): New macro.
* sysdeps/m68k/dl-machine.h (elf_machine_pltrel_p): Likewise.
* sysdeps/stub/dl-machine.h (elf_machine_pltrel_p): Likewise.
Diffstat (limited to 'elf')
-rw-r--r-- | elf/dl-lookup.c | 14 | ||||
-rw-r--r-- | elf/dl-reloc.c | 4 | ||||
-rw-r--r-- | elf/dl-runtime.c | 2 | ||||
-rw-r--r-- | elf/dlsym.c | 4 | ||||
-rw-r--r-- | elf/do-rel.h | 11 | ||||
-rw-r--r-- | elf/link.h | 7 | ||||
-rw-r--r-- | elf/rtld.c | 2 |
7 files changed, 21 insertions, 23 deletions
diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c index cb337d47cd..90c9b6a18d 100644 --- a/elf/dl-lookup.c +++ b/elf/dl-lookup.c @@ -1,5 +1,5 @@ /* Look up a symbol in the 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 @@ -22,16 +22,15 @@ Cambridge, MA 02139, USA. */ #include <link.h> #include <assert.h> -/* Search loaded objects' symbol tables for a definition of - the symbol UNDEF_NAME. If NOSELF is nonzero, then *REF - cannot satisfy the reference itself; some different binding - must be found. */ +/* Search loaded objects' symbol tables for a definition of the symbol + UNDEF_NAME. If NOPLT is nonzero, then a PLT entry cannot satisfy the + reference; some different binding must be found. */ Elf32_Addr _dl_lookup_symbol (const char *undef_name, const Elf32_Sym **ref, struct link_map *symbol_scope, const char *reference_name, - int noself) + int noplt) { unsigned long int hash = elf_hash (undef_name); struct link_map *map; @@ -60,8 +59,7 @@ _dl_lookup_symbol (const char *undef_name, const Elf32_Sym **ref, const Elf32_Sym *sym = &symtab[symidx]; if (sym->st_value == 0 || /* No value. */ - sym->st_shndx == SHN_UNDEF || /* PLT entry. */ - (noself && sym == *ref)) /* The reference can't define it. */ + (noplt && sym->st_shndx == SHN_UNDEF)) /* Unwanted PLT entry. */ continue; switch (ELF32_ST_TYPE (sym->st_info)) diff --git a/elf/dl-reloc.c b/elf/dl-reloc.c index b7d484d2df..46fc4c4def 100644 --- a/elf/dl-reloc.c +++ b/elf/dl-reloc.c @@ -60,10 +60,10 @@ _dl_relocate_object (struct link_map *l, int lazy) = ((void *) l->l_addr + l->l_info[DT_STRTAB]->d_un.d_ptr); - Elf32_Addr resolve (const Elf32_Sym **ref, Elf32_Addr r_offset) + Elf32_Addr resolve (const Elf32_Sym **ref, int noplt) { return _dl_lookup_symbol (strtab + (*ref)->st_name, ref, scope, - l->l_name, (*ref)->st_value == r_offset); + l->l_name, noplt); } real_next = l->l_next; diff --git a/elf/dl-runtime.c b/elf/dl-runtime.c index 3be90caa69..941a306df9 100644 --- a/elf/dl-runtime.c +++ b/elf/dl-runtime.c @@ -86,7 +86,7 @@ fixup ( definer = &symtab[ELF32_R_SYM (reloc->r_info)]; loadbase = _dl_lookup_symbol (strtab + definer->st_name, &definer, - scope, l->l_name, 0); + scope, l->l_name, 1); /* Restore list frobnication done above for DT_SYMBOLIC. */ l->l_next = real_next; diff --git a/elf/dlsym.c b/elf/dlsym.c index 0441e54c88..cc50650fc9 100644 --- a/elf/dlsym.c +++ b/elf/dlsym.c @@ -1,5 +1,5 @@ /* dlsym -- Look up a symbol in a shared object loaded by `dlopen'. -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 @@ -33,7 +33,7 @@ dlsym (void *handle, const char *name) int lose; void doit (void) { - loadbase = _dl_lookup_symbol (name, &ref, map, map->l_name, 1); + loadbase = _dl_lookup_symbol (name, &ref, map, map->l_name, 0); } /* Confine the symbol scope to just this map. */ diff --git a/elf/do-rel.h b/elf/do-rel.h index 72e7d01cb4..a265550cae 100644 --- a/elf/do-rel.h +++ b/elf/do-rel.h @@ -21,9 +21,9 @@ Cambridge, MA 02139, USA. */ `elf_dynamic_do_rel' and `elf_dynamic_do_rela'. */ #ifdef DO_RELA -#define elf_dynamic_do_rel elf_dynamic_do_rela -#define Elf32_Rel Elf32_Rela -#define elf_machine_rel elf_machine_rela +#define elf_dynamic_do_rel elf_dynamic_do_rela +#define Elf32_Rel Elf32_Rela +#define elf_machine_rel elf_machine_rela #endif @@ -38,7 +38,7 @@ static inline void elf_dynamic_do_rel (struct link_map *map, int reltag, int sztag, Elf32_Addr (*resolve) (const Elf32_Sym **symbol, - Elf32_Addr r_offset), + int noplt), int lazy) { const Elf32_Sym *const symtab @@ -65,7 +65,8 @@ elf_dynamic_do_rel (struct link_map *map, else { if (resolve) - loadbase = (*resolve) (&definer, r->r_offset); + loadbase = (*resolve) + (&definer, elf_machine_pltrel_p (ELF32_R_TYPE (r->r_info))); else { assert (definer->st_shndx != SHN_UNDEF); diff --git a/elf/link.h b/elf/link.h index bdcfcf27f4..cd75263e0a 100644 --- a/elf/link.h +++ b/elf/link.h @@ -185,14 +185,13 @@ extern void _dl_setup_hash (struct link_map *map); reference; it is replaced with the defining symbol, and the base load address of the defining object is returned. SYMBOL_SCOPE is the head of the chain used for searching. REFERENCE_NAME should name the object - containing the reference; it is used in error messages. If NOSELF is - nonzero, them *SYM itself cannot define the value; another binding must - be found. */ + containing the reference; it is used in error messages. If NOPLT is + nonzero, then the reference must not be resolved to a PLT entry. */ extern Elf32_Addr _dl_lookup_symbol (const char *undef, const Elf32_Sym **sym, struct link_map *symbol_scope, const char *reference_name, - int noself); + int noplt); /* List of objects currently loaded. */ diff --git a/elf/rtld.c b/elf/rtld.c index edd9c514d8..157cde51d9 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -318,7 +318,7 @@ of this helper program; chances are you did not intend to run this program.\n", const Elf32_Sym *ref = NULL; Elf32_Addr loadbase = _dl_lookup_symbol (_dl_argv[i], &ref, _dl_loaded, "argument", - 1); + 0); char buf[20], *bp; buf[sizeof buf - 1] = '\0'; bp = _itoa (ref->st_value, &buf[sizeof buf - 1], 16, 0); |