diff options
author | nwhitehorn <nwhitehorn@FreeBSD.org> | 2010-09-12 17:04:51 +0000 |
---|---|---|
committer | nwhitehorn <nwhitehorn@FreeBSD.org> | 2010-09-12 17:04:51 +0000 |
commit | 67010066267d8cb2dae3ad95759307d7637c70fb (patch) | |
tree | b482662e841f2f28f586dc6a8b870326a55c3c57 /libexec | |
parent | 599c1ac5992e739b3f945171e5410c2f0906139e (diff) | |
download | FreeBSD-src-67010066267d8cb2dae3ad95759307d7637c70fb.zip FreeBSD-src-67010066267d8cb2dae3ad95759307d7637c70fb.tar.gz |
Check for undefined weak symbols during PLT binding on powerpc64, and do
not attempt to copy NULL function descriptors. This fixes LD_BIND_NOW on
powerpc64 after r211706.
Reviewed by: kib
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/rtld-elf/powerpc64/reloc.c | 9 | ||||
-rw-r--r-- | libexec/rtld-elf/rtld.c | 2 | ||||
-rw-r--r-- | libexec/rtld-elf/rtld.h | 1 |
3 files changed, 9 insertions, 3 deletions
diff --git a/libexec/rtld-elf/powerpc64/reloc.c b/libexec/rtld-elf/powerpc64/reloc.c index b35be18..d2430e7 100644 --- a/libexec/rtld-elf/powerpc64/reloc.c +++ b/libexec/rtld-elf/powerpc64/reloc.c @@ -405,8 +405,13 @@ reloc_jmpslots(Obj_Entry *obj) (void *)target, basename(defobj->path)); #endif - reloc_jmpslot(where, target, defobj, obj, - (const Elf_Rel *) rela); + if (def == &sym_zero) { + /* Zero undefined weak symbols */ + bzero(where, sizeof(struct funcdesc)); + } else { + reloc_jmpslot(where, target, defobj, obj, + (const Elf_Rel *) rela); + } } obj->jmpslots_done = true; diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index a1b95ae..8bc8692 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -183,7 +183,7 @@ static Objlist list_main = /* Objects loaded at program startup */ static Objlist list_fini = /* Objects needing fini() calls */ STAILQ_HEAD_INITIALIZER(list_fini); -static Elf_Sym sym_zero; /* For resolving undefined weak refs. */ +Elf_Sym sym_zero; /* For resolving undefined weak refs. */ #define GDB_STATE(s,m) r_debug.r_state = s; r_debug_state(&r_debug,m); diff --git a/libexec/rtld-elf/rtld.h b/libexec/rtld-elf/rtld.h index 875e84b..6bae2f0 100644 --- a/libexec/rtld-elf/rtld.h +++ b/libexec/rtld-elf/rtld.h @@ -261,6 +261,7 @@ extern void *xcalloc(size_t); extern void *xmalloc(size_t); extern char *xstrdup(const char *); extern Elf_Addr _GLOBAL_OFFSET_TABLE_[]; +extern Elf_Sym sym_zero; /* For resolving undefined weak refs. */ extern void dump_relocations (Obj_Entry *); extern void dump_obj_relocations (Obj_Entry *); |