mirror of
https://github.com/mmueller41/genode.git
synced 2026-01-21 12:32:56 +01:00
ldso: defer execution of static constructors
Ldso now does not automatically execute static constructors of the binary and shared libraries the binary depends on. If static construction is required (e.g., if a shared library with constructor is used or a compilation unit contains global statics) the component needs to execute the constructors explicitly in Component::construct() via Genode::Env::exec_static_constructors(). In the case of libc components this is done by the libc startup code (i.e., the Component::construct() implementation in the libc). The loading of shared objects at runtime is not affected by this change and constructors of those objects are executed immediately. Fixes #2332
This commit is contained in:
@@ -160,4 +160,10 @@ struct Main : Scout::Event_handler
|
||||
};
|
||||
|
||||
|
||||
void Component::construct(Genode::Env &env) { static Main main(env); }
|
||||
void Component::construct(Genode::Env &env)
|
||||
{
|
||||
/* XXX execute constructors of global statics */
|
||||
env.exec_static_constructors();
|
||||
|
||||
static Main main(env);
|
||||
}
|
||||
|
||||
@@ -168,4 +168,10 @@ struct Scout::Main : Scout::Event_handler
|
||||
};
|
||||
|
||||
|
||||
void Component::construct(Genode::Env &env) { static Scout::Main main(env); }
|
||||
void Component::construct(Genode::Env &env)
|
||||
{
|
||||
/* XXX execute constructors of global statics */
|
||||
env.exec_static_constructors();
|
||||
|
||||
static Scout::Main main(env);
|
||||
}
|
||||
|
||||
@@ -311,4 +311,10 @@ class Liquid_fb::Main : public Scout::Event_handler
|
||||
};
|
||||
|
||||
|
||||
void Component::construct(Genode::Env &env) { static Liquid_fb::Main main(env); }
|
||||
void Component::construct(Genode::Env &env)
|
||||
{
|
||||
/* XXX execute constructors of global statics */
|
||||
env.exec_static_constructors();
|
||||
|
||||
static Liquid_fb::Main main(env);
|
||||
}
|
||||
|
||||
@@ -496,4 +496,10 @@ struct Nitlog::Main
|
||||
};
|
||||
|
||||
|
||||
void Component::construct(Genode::Env &env) { static Nitlog::Main main(env); }
|
||||
void Component::construct(Genode::Env &env)
|
||||
{
|
||||
/* XXX execute constructors of global statics */
|
||||
env.exec_static_constructors();
|
||||
|
||||
static Nitlog::Main main(env);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user