mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-03 04:26:45 +00:00
ldso: update link map during respawn
move binary to front of link map after respawn. This is required by GDB in order to load symbol files correctly. issue #3481
This commit is contained in:
parent
9c372c36c1
commit
22d4d5c1c1
@ -134,6 +134,20 @@ struct Linker::Link_map
|
|||||||
first = map->next;
|
first = map->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void make_first(Link_map *map)
|
||||||
|
{
|
||||||
|
remove(map);
|
||||||
|
|
||||||
|
if (first) {
|
||||||
|
first->prev = map;
|
||||||
|
}
|
||||||
|
|
||||||
|
map->prev = nullptr;
|
||||||
|
map->next = first;
|
||||||
|
first = map;
|
||||||
|
Debug::d()->map = map;
|
||||||
|
}
|
||||||
|
|
||||||
static void dump()
|
static void dump()
|
||||||
{
|
{
|
||||||
if (!verbose_link_map)
|
if (!verbose_link_map)
|
||||||
|
@ -193,6 +193,11 @@ class Linker::Elf_object : public Object, private Fifo<Elf_object>::Element
|
|||||||
Link_map::add(&_map);
|
Link_map::add(&_map);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void link_map_make_first()
|
||||||
|
{
|
||||||
|
Link_map::make_first(&_map);
|
||||||
|
}
|
||||||
|
|
||||||
void force_keep() { _keep = KEEP; }
|
void force_keep() { _keep = KEEP; }
|
||||||
|
|
||||||
Link_map const &link_map() const override { return _map; }
|
Link_map const &link_map() const override { return _map; }
|
||||||
@ -731,6 +736,9 @@ void *Dynamic_linker::_respawn(Env &env, char const *binary, char const *entry_n
|
|||||||
/* load new binary */
|
/* load new binary */
|
||||||
construct_at<Binary>(binary_ptr, env, *heap(), config, name.string());
|
construct_at<Binary>(binary_ptr, env, *heap(), config, name.string());
|
||||||
|
|
||||||
|
/* move to front of link map */
|
||||||
|
binary_ptr->link_map_make_first();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return (void *)binary_ptr->lookup_symbol(entry_name);
|
return (void *)binary_ptr->lookup_symbol(entry_name);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user