From af3616ed51f4eb0fd16d93f503c40bc80f7f50c3 Mon Sep 17 00:00:00 2001 From: Dale Rahn Date: Fri, 16 Sep 2005 23:19:44 +0000 Subject: Rework symbol lookup to more closely match sun's documentation, now treats dlopens as load groups. ok kurt@ --- libexec/ld.so/mips64/rtld_machine.c | 41 +++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 20 deletions(-) (limited to 'libexec/ld.so/mips64') diff --git a/libexec/ld.so/mips64/rtld_machine.c b/libexec/ld.so/mips64/rtld_machine.c index ccc6ab05b95..fde75a0bb4f 100644 --- a/libexec/ld.so/mips64/rtld_machine.c +++ b/libexec/ld.so/mips64/rtld_machine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtld_machine.c,v 1.5 2004/10/01 22:10:37 pefo Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.6 2005/09/16 23:19:42 drahn Exp $ */ /* * Copyright (c) 1998-2004 Opsycon AB, Sweden. @@ -74,14 +74,15 @@ _dl_md_reloc(elf_object_t *object, int rel, int relsz) this = NULL; got_start = 0; got_end = 0; - ooff = _dl_find_symbol("__got_start", object, &this, NULL, - SYM_SEARCH_SELF|SYM_NOWARNNOTFOUND|SYM_PLT, 0, object); + ooff = _dl_find_symbol("__got_start", &this, + SYM_SEARCH_OBJ|SYM_NOWARNNOTFOUND|SYM_PLT, 0, + object, NULL); if (this != NULL) got_start = ooff + this->st_value; - this = NULL; - ooff = _dl_find_symbol("__got_end", object, &this, NULL, - SYM_SEARCH_SELF|SYM_NOWARNNOTFOUND|SYM_PLT, 0, object); + ooff = _dl_find_symbol("__got_end", &this, + SYM_SEARCH_OBJ|SYM_NOWARNNOTFOUND|SYM_PLT, 0, + object, NULL); if (this != NULL) got_end = ooff + this->st_value; @@ -104,9 +105,9 @@ _dl_md_reloc(elf_object_t *object, int rel, int relsz) if (ELF64_R_SYM(relocs->r_info) && !(ELF64_ST_BIND(sym->st_info) == STB_LOCAL && ELF64_ST_TYPE (sym->st_info) == STT_NOTYPE)) { - ooff = _dl_find_symbol(symn, _dl_objects, &this, NULL, + ooff = _dl_find_symbol(symn, &this, SYM_SEARCH_ALL | SYM_NOWARNNOTFOUND | SYM_PLT, - sym->st_size, object); + sym->st_size, object, NULL); if (!this && ELF64_ST_BIND(sym->st_info) == STB_GLOBAL) { _dl_printf("%s: can't resolve reference '%s'\n", _dl_progname, symn); @@ -213,14 +214,16 @@ _dl_md_reloc_got(elf_object_t *object, int lazy) this = NULL; object->plt_size = 0; object->got_size = 0; - ooff = _dl_find_symbol("__got_start", object, &this, NULL, - SYM_SEARCH_SELF|SYM_NOWARNNOTFOUND|SYM_PLT, 0, object); + ooff = _dl_find_symbol("__got_start", &this, + SYM_SEARCH_OBJ|SYM_NOWARNNOTFOUND|SYM_PLT, 0, + object, NULL); if (this != NULL) object->got_start = ooff + this->st_value; this = NULL; - ooff = _dl_find_symbol("__got_end", object, &this, NULL, - SYM_SEARCH_SELF|SYM_NOWARNNOTFOUND|SYM_PLT, 0, object); + ooff = _dl_find_symbol("__got_end", &this, + SYM_SEARCH_OBJ|SYM_NOWARNNOTFOUND|SYM_PLT, 0, + object, NULL); if (this != NULL) object->got_size = ooff + this->st_value - object->got_start; @@ -234,9 +237,9 @@ _dl_md_reloc_got(elf_object_t *object, int lazy) if (symp->st_value == 0 || !lazy) { this = 0; ooff = _dl_find_symbol(strt + symp->st_name, - _dl_objects, &this, NULL, + &this, SYM_SEARCH_ALL|SYM_NOWARNNOTFOUND|SYM_PLT, - symp->st_size, object); + symp->st_size, object, NULL); if (this) *gotp = this->st_value + ooff; } else @@ -244,10 +247,9 @@ _dl_md_reloc_got(elf_object_t *object, int lazy) } else if (symp->st_shndx == SHN_COMMON || symp->st_shndx == SHN_UNDEF) { this = 0; - ooff = _dl_find_symbol(strt + symp->st_name, - _dl_objects, &this, NULL, + ooff = _dl_find_symbol(strt + symp->st_name, &this, SYM_SEARCH_ALL|SYM_NOWARNNOTFOUND|SYM_PLT, - symp->st_size, object); + symp->st_size, object, NULL); if (this) *gotp = this->st_value + ooff; } else if (ELF64_ST_TYPE(symp->st_info) == STT_FUNC && @@ -255,10 +257,9 @@ _dl_md_reloc_got(elf_object_t *object, int lazy) *gotp += loff; } else { /* Resolve all others immediatly */ this = 0; - ooff = _dl_find_symbol(strt + symp->st_name, - _dl_objects, &this, NULL, + ooff = _dl_find_symbol(strt + symp->st_name, &this, SYM_SEARCH_ALL|SYM_NOWARNNOTFOUND|SYM_PLT, - symp->st_size, object); + symp->st_size, object, NULL); if (this) *gotp = this->st_value + ooff; else -- cgit v1.2.3