diff options
| author | joerg <joerg@NetBSD.org> | 2017-08-09 18:44:32 +0000 |
|---|---|---|
| committer | joerg <joerg@NetBSD.org> | 2017-08-09 18:44:32 +0000 |
| commit | 1d74f896b309c8b678fa1fbd84fdcb556362d240 (patch) | |
| tree | cd894fadd6ef7be27db44600e54d04684a57d33b /libexec | |
| parent | ce47192c368d6a8384dcc2519d636b34750a06ec (diff) | |
If a DF_1_NODELETE DSO has been removed from the DAG list, it still
needs to be able to resolve relocations against itself. As such, search
the referencing object explicitly last, if it hasn't been searched
before.
Diffstat (limited to 'libexec')
| -rw-r--r-- | libexec/ld.elf_so/symbol.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/libexec/ld.elf_so/symbol.c b/libexec/ld.elf_so/symbol.c index 999caf40cfe..2d558d7a646 100644 --- a/libexec/ld.elf_so/symbol.c +++ b/libexec/ld.elf_so/symbol.c @@ -1,4 +1,4 @@ -/* $NetBSD: symbol.c,v 1.68 2017/06/19 11:57:01 joerg Exp $ */ +/* $NetBSD: symbol.c,v 1.69 2017/08/09 18:44:32 joerg Exp $ */ /* * Copyright 1996 John D. Polstra. @@ -40,7 +40,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: symbol.c,v 1.68 2017/06/19 11:57:01 joerg Exp $"); +__RCSID("$NetBSD: symbol.c,v 1.69 2017/08/09 18:44:32 joerg Exp $"); #endif /* not lint */ #include <err.h> @@ -480,6 +480,21 @@ _rtld_symlook_default(const char *name, unsigned long hash, } /* + * Finally, look in the referencing object if not linked symbolically. + * This is necessary for DF_1_NODELETE objects where the containing DAG + * has been unlinked, so local references are resolved properly. + */ + if ((def == NULL || ELF_ST_BIND(def->st_info) == STB_WEAK) && + !refobj->symbolic && !_rtld_donelist_check(&donelist, refobj)) { + rdbg(("search referencing object for %s", name)); + symp = _rtld_symlook_obj(name, hash, refobj, flags, ventry); + if (symp != NULL) { + def = symp; + defobj = refobj; + } + } + + /* * Search the dynamic linker itself, and possibly resolve the * symbol from there. This is how the application links to * dynamic linker services such as dlopen. |
