mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-18 18:56:29 +00:00
ldso: mark functions used during self relocation
These functions are marked as always inline through the 'SELF_RELOC' macro. This became necessary because on riscv functions calls are performed through the global offset table, which is not initialized at this point. Fixes #2203
This commit is contained in:
parent
f2568856dd
commit
6e14aa4364
@ -144,7 +144,7 @@ class Linker::Dynamic
|
||||
_d->un.ptr = (Elf::Addr)Debug::d();
|
||||
}
|
||||
|
||||
void _init()
|
||||
void _init() SELF_RELOC
|
||||
{
|
||||
for (Elf::Dyn const *d = &_dynamic; d->tag != DT_NULL; d++) {
|
||||
switch (d->tag) {
|
||||
@ -308,7 +308,7 @@ class Linker::Dynamic
|
||||
fn(n->path(_strtab));
|
||||
}
|
||||
|
||||
void relocate(Bind bind)
|
||||
void relocate(Bind bind) SELF_RELOC
|
||||
{
|
||||
plt_setup();
|
||||
|
||||
|
@ -20,6 +20,13 @@
|
||||
#include <file.h>
|
||||
#include <util.h>
|
||||
|
||||
/*
|
||||
* Mark functions that are used during the linkers self-relocation phase as
|
||||
* always inline. Some platforms (riscv) perform function calls through the
|
||||
* GOT that is not initialized (zero) at this state.
|
||||
*/
|
||||
#define SELF_RELOC __attribute__((always_inline))
|
||||
|
||||
/**
|
||||
* Forward declartions and helpers
|
||||
*/
|
||||
|
@ -197,7 +197,7 @@ class Linker::Elf_object : public Object, public Fifo<Elf_object>::Element
|
||||
|
||||
void update_dependency(Dependency const &dep) { _dyn.dep(dep); }
|
||||
|
||||
void relocate(Bind bind) override
|
||||
void relocate(Bind bind) override SELF_RELOC
|
||||
{
|
||||
if (!_relocated)
|
||||
_dyn.relocate(bind);
|
||||
|
Loading…
Reference in New Issue
Block a user