mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-20 17:52:52 +00:00
ldso: Fix RISC-V support with 21.05 tool chain
- force inlining of more functions - force -O2 for RISC-V (even if -O0 is set globally) - intialize cxx guard after self relocation issue #4094
This commit is contained in:
parent
a6fe6c90d4
commit
fd9bc43be1
@ -1,3 +1,9 @@
|
||||
#
|
||||
# Force to build -O2 on RISC-V in order to get proper inlining during self
|
||||
# relocation
|
||||
#
|
||||
override CC_OLEVEL = -O2
|
||||
|
||||
include $(BASE_DIR)/lib/mk/ld-platform.inc
|
||||
|
||||
INC_DIR += $(DIR)/spec/riscv
|
||||
|
@ -179,7 +179,7 @@ class Linker::Dynamic
|
||||
|
||||
enum Pass { FIRST_PASS, SECOND_PASS };
|
||||
|
||||
Dynamic(Dependency const &dep)
|
||||
Dynamic(Dependency const &dep) SELF_RELOC
|
||||
:
|
||||
_dep(&dep), _obj(dep.obj()), _dynamic(*(Elf::Dyn *)dynamic_address())
|
||||
{
|
||||
@ -339,7 +339,7 @@ class Linker::Dynamic
|
||||
Plt_got r(*_dep, _pltgot);
|
||||
}
|
||||
|
||||
void relocate_non_plt(Bind bind, Pass pass)
|
||||
void relocate_non_plt(Bind bind, Pass pass) SELF_RELOC
|
||||
{
|
||||
if (_reloca)
|
||||
Reloc_non_plt r(*_dep, _reloca, _reloca_size, pass == SECOND_PASS);
|
||||
|
@ -127,7 +127,7 @@ class Linker::Elf_object : public Object, private Fifo<Elf_object>::Element
|
||||
public:
|
||||
|
||||
Elf_object(Dependency const &dep, Object::Name const &name,
|
||||
Elf::Addr reloc_base)
|
||||
Elf::Addr reloc_base) SELF_RELOC
|
||||
:
|
||||
_elf_object_initialized(_object_init(name, reloc_base)),
|
||||
_dyn(dep)
|
||||
@ -261,7 +261,7 @@ class Linker::Elf_object : public Object, private Fifo<Elf_object>::Element
|
||||
*/
|
||||
struct Linker::Ld : private Dependency, Elf_object
|
||||
{
|
||||
Ld() :
|
||||
Ld() SELF_RELOC :
|
||||
Dependency(*this, nullptr),
|
||||
Elf_object(*this, linker_name(), relocation_address())
|
||||
{ }
|
||||
@ -651,9 +651,6 @@ Elf::Sym const *Linker::lookup_symbol(char const *name, Dependency const &dep,
|
||||
*/
|
||||
extern "C" void init_rtld()
|
||||
{
|
||||
/* init cxa guard mechanism before any local static variables are used */
|
||||
init_cxx_guard();
|
||||
|
||||
/*
|
||||
* Allocate on stack, since the linker has not been relocated yet, the vtable
|
||||
* type relocation might produce a wrong vtable pointer (at least on ARM), do
|
||||
@ -662,6 +659,9 @@ extern "C" void init_rtld()
|
||||
Ld linker_on_stack;
|
||||
linker_on_stack.relocate(BIND_LAZY);
|
||||
|
||||
/* init cxa guard mechanism before any local static variables are used */
|
||||
init_cxx_guard();
|
||||
|
||||
/*
|
||||
* Create actual linker object with different vtable type and set PLT to new
|
||||
* DAG.
|
||||
|
Loading…
x
Reference in New Issue
Block a user