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:
Martin Stein 2014-02-05 14:58:37 +01:00 committed by Norman Feske
parent 6e2b7c2b92
commit 324af5d769
2 changed files with 22 additions and 0 deletions

View File

@ -115,6 +115,12 @@ ifeq ($(SHARED_LIBS),)
LD_SCRIPTS := $(LD_SCRIPT_STATIC)
FILTER_DEPS := $(DEPS:.lib=)
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_CMD += -Wl,--dynamic-linker=$(DYNAMIC_LINKER).lib.so \
-Wl,--eh-frame-hdr

View 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;
};