mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-18 17:00:26 +00:00
ldso: check binary pointer before lookup
Check if the binary pointer is valid before attempting to lookup the symbol. Shared objects with unresolved symbols and missing depencies, e.g a library that references 'errno' but is not linked against libc, will now produce an error message when they are loaded by the dynamic linker. Fixes #1904.
This commit is contained in:
parent
f46a504bb6
commit
2490e399dc
@ -484,8 +484,14 @@ Elf::Sym const *Linker::lookup_symbol(char const *name, Dependency const *dep,
|
||||
}
|
||||
|
||||
/* try searching binary's dependencies */
|
||||
if (!weak_symbol && dep->root && dep != binary->dep.head())
|
||||
return lookup_symbol(name, binary->dep.head(), base, undef, other);
|
||||
if (!weak_symbol && dep->root) {
|
||||
if (binary && dep != binary->dep.head()) {
|
||||
return lookup_symbol(name, binary->dep.head(), base, undef, other);
|
||||
} else {
|
||||
PERR("Could not lookup symbol \"%s\"", name);
|
||||
throw Not_found();
|
||||
}
|
||||
}
|
||||
|
||||
if (dep->root && verbose_lookup)
|
||||
PDBG("Return %p", weak_symbol);
|
||||
|
Loading…
x
Reference in New Issue
Block a user