genode/repos/libports/recipes/pkg/test-ldso/runtime
Norman Feske 852ab79359 Move atexit handling from base lib to libc
This patch untangles the interplay of the base library and the libc
during the exit handling.

- The CXA ABI for the atexit handling is now provided by the libc.
  For plain Genode components without libc dependency, __cxa_atexit
  is a no-op, which is consistent with Genode's notion of components.

- The 'abort' implementation of the base library no longer calls
  'genode_exit' but merely 'sleep_forever'. This way, the cxx library
  no longer depends on a 'genode_exit' implementation.

- The libc provides 'atexit' support by storing metadata on the
  libc kernel's heap now, thereby eliminating the former bounded
  maximum number of atexit handlers.

- Shared-library dtors are no longer called via the atexit mechanism
  by explicitly by the dynamic linker. This slightly changes the
  call order of destructors (adjustment of the ldso test). Functions
  marked as destructors are called after the atexit handlers now.

- The libc executes atexit handlers in the application context,
  which supports the I/O operations in those handles, in particular
  the closing of file descriptors.

Fixes #3851
2020-08-25 11:50:09 +02:00

139 lines
5.6 KiB
Plaintext

<runtime ram="32M" caps="1000" binary="init">
<requires> <timer/> </requires>
<events>
<timeout meaning="failed" sec="20" />
<log meaning="succeeded">
[init -> test-ldso] Lib_2_global 0x11223343*
[init -> test-ldso] Lib_1_global_1 0x5060707*
[init -> test-ldso] Lib_1_global_2 0x1020303*
[init -> test-ldso] lib_1_attr_constructor_2 0x4030200f*
[init -> test-ldso] lib_1_attr_constructor_1 0x8070604f*
[init -> test-ldso] Global_1 0x5060707*
[init -> test-ldso] Global_2 0x1020303*
[init -> test-ldso] attr_constructor_2 0x4030200f*
[init -> test-ldso] attr_constructor_1 0x8070604f*
[init -> test-ldso] *
[init -> test-ldso] Dynamic-linker test*
[init -> test-ldso] ===================*
[init -> test-ldso] *
[init -> test-ldso] Global objects and local static objects of program*
[init -> test-ldso] --------------------------------------------------*
[init -> test-ldso] global_1 0x5060706*
[init -> test-ldso] global_2 0x1020302*
[init -> test-ldso] Local_1 0x5060707f*
[init -> test-ldso] local_1 0x5060707e*
[init -> test-ldso] Local_2 0x1020303f*
[init -> test-ldso] local_2 0x1020303e*
[init -> test-ldso] pod_1 0x8070604e*
[init -> test-ldso] pod_2 0x4030200e*
[init -> test-ldso] *
[init -> test-ldso] Access shared lib from program*
[init -> test-ldso] ------------------------------*
[init -> test-ldso] lib_2_global 0x11223342*
[init -> test-ldso] Lib_1_local_3 0x12345677*
[init -> test-ldso] lib_1_local_3 0x12345676*
[init -> test-ldso] lib_1_pod_1 0x8070604d*
[init -> test-ldso] Libc::read:*
[init -> test-ldso] *Error: no plugin found for read(3)*
[init -> test-ldso] Libc::abs(-10): 10*
[init -> test-ldso] *
[init -> test-ldso] Catch exceptions in program*
[init -> test-ldso] ---------------------------*
[init -> test-ldso] *Error: ROM-session creation failed (ram_quota=*, cap_quota=*, label="unknown_rom")*
[init -> test-ldso] *Error: Could not open ROM session for "unknown_rom"*
[init -> test-ldso] exception in remote procedure call: caught*
[init -> test-ldso] exception in program: caught*
[init -> test-ldso] exception in shared lib: caught*
[init -> test-ldso] exception in dynamic linker: caught*
[init -> test-ldso] *
[init -> test-ldso] global objects and local static objects of shared lib*
[init -> test-ldso] -----------------------------------------------------*
[init -> test-ldso] lib_1_global_1 0x5060706*
[init -> test-ldso] lib_1_global_2 0x1020302*
[init -> test-ldso] Lib_1_local_1 0x5060707f*
[init -> test-ldso] lib_1_local_1 0x5060707e*
[init -> test-ldso] Lib_1_local_2 0x1020303f*
[init -> test-ldso] lib_1_local_2 0x1020303e*
[init -> test-ldso] lib_1_pod_1 0x8070604e*
[init -> test-ldso] lib_1_pod_2 0x4030200e*
[init -> test-ldso] *
[init -> test-ldso] Access shared lib from another shared lib*
[init -> test-ldso] -----------------------------------------*
[init -> test-ldso] lib_2_global 0x11223341*
[init -> test-ldso] Lib_2_local 0x55667787*
[init -> test-ldso] lib_2_local 0x55667786*
[init -> test-ldso] lib_2_pod_1 0x87654320*
[init -> test-ldso] *
[init -> test-ldso] Catch exceptions in shared lib*
[init -> test-ldso] ------------------------------*
[init -> test-ldso] exception in lib: caught*
[init -> test-ldso] exception in another shared lib: caught*
[init -> test-ldso] *
[init -> test-ldso] Test stack alignment*
[init -> test-ldso] --------------------*
[init -> test-ldso] &lt;warning: unsupported format string argument>*
[init -> test-ldso] &lt;warning: unsupported format string argument>*
[init -> test-ldso] &lt;warning: unsupported format string argument>*
[init -> test-ldso] &lt;warning: unsupported format string argument>*
[init -> test-ldso] *
[init -> test-ldso] Dynamic cast*
[init -> test-ldso] ------------*
[init -> test-ldso] 'Object' called: good*
[init -> test-ldso] *
[init -> test-ldso] Shared-object API*
[init -> test-ldso] -----------------*
[init -> test-ldso] Global object constructed*
[init -> test-ldso] *
[init -> test-ldso] Destruction*
[init -> test-ldso] -----------*
[init -> test-ldso] ~Lib_2_local 0x55667785*
[init -> test-ldso] ~Lib_1_local_2 0x1020303d*
[init -> test-ldso] ~Lib_1_local_1 0x5060707d*
[init -> test-ldso] ~Lib_1_local_3 0x12345675*
[init -> test-ldso] ~Local_2 0x1020303d*
[init -> test-ldso] ~Local_1 0x5060707d*
[init -> test-ldso] ~Global_2 0x1020301*
[init -> test-ldso] ~Global_1 0x5060705*
[init -> test-ldso] ~Lib_1_global_2 0x1020301*
[init -> test-ldso] ~Lib_1_global_1 0x5060705*
[init -> test-ldso] ~Lib_2_global 0x11223340*
[init -> test-ldso] attr_destructor_2 0x4030200d*
[init -> test-ldso] attr_destructor_1 0x8070604c*
[init] child "test-ldso" exited with exit value 123
</log>
</events>
<content>
<rom label="ld.lib.so"/>
<rom label="test-ldso_lib_1.lib.so"/>
<rom label="test-ldso_lib_2.lib.so"/>
<rom label="test-ldso_lib_dl.lib.so"/>
<rom label="libc.lib.so"/>
<rom label="libm.lib.so"/>
<rom label="vfs.lib.so"/>
<rom label="test-ldso"/>
</content>
<config>
<parent-provides>
<service name="ROM"/>
<service name="CPU"/>
<service name="LOG"/>
<service name="PD"/>
</parent-provides>
<default-route>
<any-service> <parent/> </any-service>
</default-route>
<default caps="100"/>
<start name="test-ldso">
<resource name="RAM" quantum="3M"/>
<config ld_bind_now="no" ld_verbose="no">
<vfs> <dir name="dev"> <log/> </dir> </vfs>
<libc stdout="/dev/log"/>
</config>
</start>
</config>
</runtime>