mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-19 05:37:54 +00:00
ldso: output loaded objects of 'Shared_object' interface
When loading shared libraries via the 'Shared_object' interface display all additionaly loaded libraries in case 'ld_verbose' is configured. Up until now, only the loaded library was displayed. In order to determine if a dependend library had arlready been loaded prior to loading the 'Shared_object' the reference counter is used. fixes #4147
This commit is contained in:
parent
f8d0552d52
commit
9209dfc9d5
@ -228,6 +228,11 @@ class Linker::Object : private Fifo<Object>::Element,
|
||||
virtual void load() = 0;
|
||||
virtual bool unload() { return false;}
|
||||
|
||||
/**
|
||||
* Did this ELF require loading or was it present already
|
||||
*/
|
||||
virtual bool already_present() const { return false; }
|
||||
|
||||
/**
|
||||
* Next object in initialization list
|
||||
*/
|
||||
|
@ -247,6 +247,8 @@ class Linker::Elf_object : public Object, private Fifo<Elf_object>::Element
|
||||
void load() override { _ref_count++; }
|
||||
bool unload() override { return (_keep == DONT_KEEP) && !(--_ref_count); }
|
||||
|
||||
bool already_present() const override { return _ref_count > 1; }
|
||||
|
||||
bool keep() const override { return _keep == KEEP; }
|
||||
|
||||
bool is_linker() const override { return false; }
|
||||
|
@ -59,16 +59,20 @@ Genode::Shared_object::Shared_object(Env &env, Allocator &md_alloc,
|
||||
try {
|
||||
Mutex::Guard guard(Linker::shared_object_mutex());
|
||||
|
||||
_handle = new (md_alloc)
|
||||
Root_object *root = new (md_alloc)
|
||||
Root_object(env, md_alloc, file ? file : binary_name(),
|
||||
bind == BIND_NOW ? Linker::BIND_NOW : Linker::BIND_LAZY,
|
||||
keep == KEEP ? Linker::KEEP : Linker::DONT_KEEP);
|
||||
|
||||
_handle = root;
|
||||
|
||||
/* print loaded object information */
|
||||
try {
|
||||
if (Linker::verbose)
|
||||
Linker::dump_link_map(to_root(_handle).first_dep()->obj());
|
||||
} catch (...) { }
|
||||
if (Linker::verbose) {
|
||||
root->deps().for_each([] (Linker::Dependency const &dep) {
|
||||
if (dep.obj().already_present()) return;
|
||||
Linker::dump_link_map(dep.obj());
|
||||
});
|
||||
}
|
||||
|
||||
} catch(Linker::Not_found &symbol) {
|
||||
warning("LD: symbol not found: '", symbol, "'");
|
||||
|
Loading…
Reference in New Issue
Block a user