mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-18 15:18:20 +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:
committed by
Norman Feske
parent
f2568856dd
commit
6e14aa4364
@ -144,7 +144,7 @@ class Linker::Dynamic
|
|||||||
_d->un.ptr = (Elf::Addr)Debug::d();
|
_d->un.ptr = (Elf::Addr)Debug::d();
|
||||||
}
|
}
|
||||||
|
|
||||||
void _init()
|
void _init() SELF_RELOC
|
||||||
{
|
{
|
||||||
for (Elf::Dyn const *d = &_dynamic; d->tag != DT_NULL; d++) {
|
for (Elf::Dyn const *d = &_dynamic; d->tag != DT_NULL; d++) {
|
||||||
switch (d->tag) {
|
switch (d->tag) {
|
||||||
@ -308,7 +308,7 @@ class Linker::Dynamic
|
|||||||
fn(n->path(_strtab));
|
fn(n->path(_strtab));
|
||||||
}
|
}
|
||||||
|
|
||||||
void relocate(Bind bind)
|
void relocate(Bind bind) SELF_RELOC
|
||||||
{
|
{
|
||||||
plt_setup();
|
plt_setup();
|
||||||
|
|
||||||
|
@ -20,6 +20,13 @@
|
|||||||
#include <file.h>
|
#include <file.h>
|
||||||
#include <util.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
|
* 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 update_dependency(Dependency const &dep) { _dyn.dep(dep); }
|
||||||
|
|
||||||
void relocate(Bind bind) override
|
void relocate(Bind bind) override SELF_RELOC
|
||||||
{
|
{
|
||||||
if (!_relocated)
|
if (!_relocated)
|
||||||
_dyn.relocate(bind);
|
_dyn.relocate(bind);
|
||||||
|
Reference in New Issue
Block a user