Merge "Adjust symbol lookup for DT_SYMBOLIC case"
This commit is contained in:
commit
ed537239a9
32
linker/linker.cpp
Normal file → Executable file
32
linker/linker.cpp
Normal file → Executable file
@ -458,7 +458,21 @@ soinfo_do_lookup(soinfo *si, const char *name, soinfo **lsi,
|
|||||||
Elf32_Sym *s = NULL;
|
Elf32_Sym *s = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (si != NULL) {
|
if (si != NULL && somain != NULL) {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Local scope is executable scope. Just start looking into it right away
|
||||||
|
* for the shortcut.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (si == somain) {
|
||||||
|
s = soinfo_elf_lookup(si, elf_hash, name);
|
||||||
|
if (s != NULL) {
|
||||||
|
*lsi = si;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* Order of symbol lookup is controlled by DT_SYMBOLIC flag */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If this object was built with symbolic relocations disabled, the
|
* If this object was built with symbolic relocations disabled, the
|
||||||
@ -491,6 +505,22 @@ soinfo_do_lookup(soinfo *si, const char *name, soinfo **lsi,
|
|||||||
*lsi = si;
|
*lsi = si;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If this object was built with -Bsymbolic and symbol is not found
|
||||||
|
* in the local scope, try to find the symbol in the main executable.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (si->has_DT_SYMBOLIC) {
|
||||||
|
DEBUG("%5d %s: looking up %s in executable %s after local scope\n",
|
||||||
|
pid, si->name, name, somain->name);
|
||||||
|
s = soinfo_elf_lookup(somain, elf_hash, name);
|
||||||
|
if (s != NULL) {
|
||||||
|
*lsi = somain;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Next, look for it in the preloads list */
|
/* Next, look for it in the preloads list */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user