mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-25 00:11:07 +00:00
os: make program ctors and dtors visible to LDSO
This is needed later when eliminating the need for a startup lib in dynamic programs to enable LDSO to call ctors and dtors of the program. Issue #1042
This commit is contained in:
parent
6e2b7c2b92
commit
324af5d769
@ -115,6 +115,12 @@ ifeq ($(SHARED_LIBS),)
|
|||||||
LD_SCRIPTS := $(LD_SCRIPT_STATIC)
|
LD_SCRIPTS := $(LD_SCRIPT_STATIC)
|
||||||
FILTER_DEPS := $(DEPS:.lib=)
|
FILTER_DEPS := $(DEPS:.lib=)
|
||||||
else
|
else
|
||||||
|
|
||||||
|
#
|
||||||
|
# Add a list of symbols that shall always be added to the dynsym section
|
||||||
|
#
|
||||||
|
LD_OPT += --dynamic-list=$(call select_from_repositories,src/platform/genode_dyn.dl)
|
||||||
|
|
||||||
LD_SCRIPTS := $(LD_SCRIPT_DYN)
|
LD_SCRIPTS := $(LD_SCRIPT_DYN)
|
||||||
LD_CMD += -Wl,--dynamic-linker=$(DYNAMIC_LINKER).lib.so \
|
LD_CMD += -Wl,--dynamic-linker=$(DYNAMIC_LINKER).lib.so \
|
||||||
-Wl,--eh-frame-hdr
|
-Wl,--eh-frame-hdr
|
||||||
|
16
os/src/platform/genode_dyn.dl
Normal file
16
os/src/platform/genode_dyn.dl
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
/*
|
||||||
|
* Symbols that shall always be added to the section '.dynsym'
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* The ctors and dtors symbols are not used by a dynamic program as such
|
||||||
|
* programs have no '_main' function. Hence the linker doesn't add them to
|
||||||
|
* the dynsym section by itself. However, we need to lookup the ctors and
|
||||||
|
* dtors arrays of the dynamic program in LDSO, which is why we must
|
||||||
|
* explicitely add them to the dynsym section.
|
||||||
|
*/
|
||||||
|
_ctors_start;
|
||||||
|
_ctors_end;
|
||||||
|
_dtors_start;
|
||||||
|
_dtors_end;
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user