aboutsummaryrefslogtreecommitdiff
path: root/elf/dl-lookup.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1995-06-12 09:00:13 +0000
committerRoland McGrath <roland@gnu.org>1995-06-12 09:00:13 +0000
commitf2b0f935d7c8de544408181350c13d8a4db690ca (patch)
tree658304e442dad6ff4c31f1d1d6a3293b7509f20d /elf/dl-lookup.c
parent5bf62f2d3a8af353fac661b224fc1604d4de51ea (diff)
downloadglibc-f2b0f935d7c8de544408181350c13d8a4db690ca.tar
glibc-f2b0f935d7c8de544408181350c13d8a4db690ca.tar.gz
glibc-f2b0f935d7c8de544408181350c13d8a4db690ca.tar.bz2
glibc-f2b0f935d7c8de544408181350c13d8a4db690ca.zip
* elf/dl-load.c (_dl_map_object): Add MAP_INHERIT flag in mmap
from zero fill. * elf/dl-lookup.c (_dl_lookup_symbol): Take new flag arg NOSELF; if nonzero, don't let *REF satisfy the reference itself. * elf/link.h (_dl_lookup_symbol): Add new arg NOSELF in decl. * sysdeps/i386/dl-runtime.c (_dl_runtime_resolve): Pass new arg to _dl_lookup_symbol. * elf/do-rel.h (elf_dynamic_do_rel): Pass new second arg of R->r_offset to RESOLVE callback. * elf/dl-reloc.c (_dl_relocate_object: resolve): Don't let *REF satisfy the reference itself if its value equals the reloc's offset. * elf/rtld.c (dl_main): Write a newline in fatal msg. * Makerules (lib%.so: lib%_pic.a): Pass $(LDFLAGS.so).
Diffstat (limited to 'elf/dl-lookup.c')
-rw-r--r--elf/dl-lookup.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
index 4d5d795ee5..ca0f03489d 100644
--- a/elf/dl-lookup.c
+++ b/elf/dl-lookup.c
@@ -23,13 +23,15 @@ Cambridge, MA 02139, USA. */
#include <assert.h>
/* Search loaded objects' symbol tables for a definition of
- the symbol UNDEF_NAME. Don't use a PLT defn in UNDEF_MAP, since
- that is the object making the reference. */
+ the symbol UNDEF_NAME. If NOSELF is nonzero, then *REF
+ cannot satisfy the reference itself; 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)
+ const char *reference_name,
+ int noself)
{
unsigned long int hash = elf_hash (undef_name);
struct link_map *map;
@@ -57,7 +59,9 @@ _dl_lookup_symbol (const char *undef_name, const Elf32_Sym **ref,
{
const Elf32_Sym *sym = &symtab[symidx];
- if (sym->st_value == 0)
+ if (sym->st_value == 0 || /* No value. */
+ sym->st_shndx == SHN_UNDEF || /* PLT entry. */
+ (noself && sym == *ref)) /* The reference can't define it. */
continue;
switch (ELF32_ST_TYPE (sym->st_info))
@@ -71,12 +75,6 @@ _dl_lookup_symbol (const char *undef_name, const Elf32_Sym **ref,
continue;
}
- if (sym->st_shndx == SHN_UNDEF)
- /* This is the same symbol we are looking for the value for.
- If it is a PLT entry, it will have a value of its own;
- but that is not what we are looking for. */
- continue;
-
if (sym != *ref && strcmp (strtab + sym->st_name, undef_name))
/* Not the symbol we are looking for. */
continue;