dde_rump: eliminate global ctors

This commit is contained in:
Christian Helmuth 2019-10-02 14:23:28 +02:00
parent e281174dae
commit 97df705e53
9 changed files with 97 additions and 14 deletions

View File

@ -39,7 +39,7 @@ class Rump::Env
public: public:
Env(Genode::Env &env) : _env(env) { } Env(Genode::Env &env);
Genode::Env &env() { return _env; } Genode::Env &env() { return _env; }
Timeout_entrypoint &timeout_ep() { return _timeout_ep; } Timeout_entrypoint &timeout_ep() { return _timeout_ep; }

View File

@ -17,4 +17,6 @@ $(OBJ_PREFIX): $(SRC_NOLINK_OBJ) $(SRC_NOLINK)
$(RUMP_LIB_BASE)/$(subst rmpns_,,$@) $(RUMP_LIB_BASE)/$@ $(RUMP_LIB_BASE)/$(subst rmpns_,,$@) $(RUMP_LIB_BASE)/$@
$(VERBOSE_MK)rm $(RUMP_LIB_BASE)/_$@ $(VERBOSE_MK)rm $(RUMP_LIB_BASE)/_$@
-include $(SRC_NOLINK_OBJ:.o=.d)
# vi:set ft=make : # vi:set ft=make :

View File

@ -1,3 +1,36 @@
--- src/lib/dde_rump/src/sys/rump/librump/rumpkern/rump_private.h
+++ src/lib/dde_rump/src/sys/rump/librump/rumpkern/rump_private.h
@@ -70,6 +70,9 @@
RUMP__FACTION_NET,
RUMP_COMPONENT_MAX,
+
+ /* alias for syscall type used to create ctor symbol */
+ RUMP_COMPONENT_KERN_SYSCALL = RUMP_COMPONENT_SYSCALL,
};
struct rump_component {
enum rump_component_type rc_type;
@@ -86,8 +89,7 @@
#ifdef RUMP_USE_CTOR
#define _RUMP_COMPONENT_REGISTER(type) \
-static void rumpcomp_ctor##type(void) __attribute__((constructor)); \
-static void rumpcomp_ctor##type(void) \
+void rumpcompctor_##type(void) \
{ \
rump_component_load(&rumpcomp##type); \
}
--- src/lib/dde_rump/src/sys/rump/librump/rumpkern/rumpkern_syscalls.c
+++ src/lib/dde_rump/src/sys/rump/librump/rumpkern/rumpkern_syscalls.c
@@ -147,7 +147,7 @@
{ 477, sys_clock_nanosleep },
};
-RUMP_COMPONENT(RUMP_COMPONENT_SYSCALL)
+RUMP_COMPONENT(RUMP_COMPONENT_KERN_SYSCALL)
{
rump_syscall_boot_establish(mysys, __arraycount(mysys));
--- src/lib/dde_rump/src/sys/rump/librump/rumpvfs/vm_vfs.c --- src/lib/dde_rump/src/sys/rump/librump/rumpvfs/vm_vfs.c
+++ src/lib/dde_rump/src/sys/rump/librump/rumpvfs/vm_vfs.c +++ src/lib/dde_rump/src/sys/rump/librump/rumpvfs/vm_vfs.c
@@ -49,6 +49,7 @@ @@ -49,6 +49,7 @@
@ -66,3 +99,15 @@
mutex_enter(bp->b_objlock); mutex_enter(bp->b_objlock);
vwakeup(bp); vwakeup(bp);
mutex_exit(bp->b_objlock); mutex_exit(bp->b_objlock);
--- src/lib/dde_rump/src/sys/sys/module.h
+++ src/lib/dde_rump/src/sys/sys/module.h
@@ -114,8 +114,7 @@
};
LIST_HEAD(modinfo_boot_chain, modinfo_chain);
#define _MODULE_REGISTER(name) \
-static void modctor_##name(void) __attribute__((constructor)); \
-static void modctor_##name(void) \
+void modctor_##name(void) \
{ \
static struct modinfo_chain mc = { \
.mc_info = &name##_modinfo, \

View File

@ -1 +1 @@
e82aa761750a0a1e76e886fa7ad37da043afe931 b81e1b234bf98a6b0a35dec429e8a826b735bc08

View File

@ -5,4 +5,4 @@ URL(rump) := https://github.com/ssumpf/rump.git
DIR(rump) := src/lib/dde_rump DIR(rump) := src/lib/dde_rump
REV(rump) := 206ffa06cedd0779af0043997fd182b00ff4688c REV(rump) := 206ffa06cedd0779af0043997fd182b00ff4688c
PATCHES := patches/vm_vfs.patch PATCHES := patches/rump.patch

View File

@ -13,19 +13,29 @@
#include <rump/env.h> #include <rump/env.h>
/* static Rump::Env *_env_ptr;
* Genode enviroment instance
*/
static Genode::Constructible<Rump::Env> _env;
Rump::Env &Rump::env() Rump::Env &Rump::env()
{ {
return *_env; return *_env_ptr;
} }
void Rump::construct_env(Genode::Env &env) void Rump::construct_env(Genode::Env &env)
{ {
_env.construct(env); static Rump::Env _env(env);
_env_ptr = &_env;
}
/* constructors in rump.lib.so */
extern "C" void rumpns_modctor_ksem(void);
extern "C" void rumpns_modctor_suser(void);
Rump::Env::Env(Genode::Env &env) : _env(env)
{
/* call init/constructor functions of rump.lib.so */
rumpns_modctor_ksem();
rumpns_modctor_suser();
} }

View File

@ -166,8 +166,33 @@ void rump_io_backend_sync()
} }
/* constructors in rump_fs.lib.so */
extern "C" void rumpcompctor_RUMP_COMPONENT_KERN_SYSCALL(void);
extern "C" void rumpcompctor_RUMP_COMPONENT_SYSCALL(void);
extern "C" void rumpcompctor_RUMP__FACTION_VFS(void);
extern "C" void rumpcompctor_RUMP__FACTION_DEV(void);
extern "C" void rumpns_modctor_cd9660(void);
extern "C" void rumpns_modctor_dk_subr(void);
extern "C" void rumpns_modctor_ext2fs(void);
extern "C" void rumpns_modctor_ffs(void);
extern "C" void rumpns_modctor_msdos(void);
extern "C" void rumpns_modctor_wapbl(void);
void rump_io_backend_init() void rump_io_backend_init()
{ {
/* call init/constructor functions of rump_fs.lib.so (order is important!) */
rumpcompctor_RUMP_COMPONENT_KERN_SYSCALL();
rumpns_modctor_wapbl();
rumpcompctor_RUMP_COMPONENT_SYSCALL();
rumpcompctor_RUMP__FACTION_VFS();
rumpcompctor_RUMP__FACTION_DEV();
rumpns_modctor_msdos();
rumpns_modctor_ffs();
rumpns_modctor_ext2fs();
rumpns_modctor_dk_subr();
rumpns_modctor_cd9660();
/* create back end */ /* create back end */
backend(); backend();
} }

View File

@ -137,14 +137,14 @@ append_if $use_ram_block config {
append_if $use_vfs_server config " append_if $use_vfs_server config "
<start name=\"vfs\" caps=\"200\"> <start name=\"vfs\" caps=\"200\">
<resource name=\"RAM\" quantum=\"8M\" /> <resource name=\"RAM\" quantum=\"12M\" />
<provides><service name=\"File_system\"/></provides> <provides><service name=\"File_system\"/></provides>
<config> <config>
<vfs> <vfs>
<dir name=\"dev\"> <log/> </dir>} <dir name=\"dev\"> <log/> </dir>}
$test_vfs_config $test_vfs_config
</vfs> </vfs>
<policy label_prefix=\"test-libc_vfs\" writeable=\"yes\"/> <policy label_prefix=\"test-libc_vfs\" root=\"/\" writeable=\"yes\"/>
</config> </config>
</start>" </start>"

View File

@ -8,19 +8,21 @@ depot_download
depot_query depot_query
extract extract
fb_bench fb_bench
fetchurl_lxip
fetchurl_lwip fetchurl_lwip
fetchurl_lxip
fs_query fs_query
gdb_monitor gdb_monitor
ieee754 ieee754
init_smp init_smp
input_filter input_filter
libc_fatfs libc_fatfs
libc_vfs_fs_ext2
log_core log_core
lwip lwip
lx_hybrid_ctors lx_hybrid_ctors
lx_hybrid_exception lx_hybrid_exception
lx_hybrid_pthread_ipc lx_hybrid_pthread_ipc
microcode
moon moon
netperf_lwip netperf_lwip
netperf_lwip_bridge netperf_lwip_bridge
@ -69,9 +71,9 @@ vbox5_ubuntu_16_04_32
vbox5_ubuntu_16_04_64 vbox5_ubuntu_16_04_64
vbox5_vm_ubuntu_16_04_32 vbox5_vm_ubuntu_16_04_32
vbox5_vm_ubuntu_16_04_64 vbox5_vm_ubuntu_16_04_64
vbox5_vm_win10_64
vbox5_vm_win7_32 vbox5_vm_win7_32
vbox5_vm_win7_64 vbox5_vm_win7_64
vbox5_vm_win10_64
vbox5_win10_64 vbox5_win10_64
vbox5_win7_32 vbox5_win7_32
vbox5_win7_64 vbox5_win7_64
@ -82,4 +84,3 @@ verify
vfs_import vfs_import
vmm_arm vmm_arm
vmm_x86 vmm_x86
microcode