ldso: Support for setting global object values

Make 'set_program_var' accessible outside of 'rtld.c'. Also, compile
dynamically linked programs with the '-fPIC' option. Doing not so,
yields to program-global symbols being put in the '.symtab' section
(which can be stripped) only. In order to get access to global
variables from the dynamic linker, the symbols need to reside within
the '.dynsym' section additionally. Hence the '-fPIC'.

ref #989
fix #1002
This commit is contained in:
Sebastian Sumpf
2013-12-10 13:22:58 +01:00
committed by Norman Feske
parent 1aadce4496
commit b8beba5bf3
3 changed files with 10 additions and 2 deletions

View File

@@ -64,6 +64,7 @@ endif
#
CXX_LINK_OPT += $(CC_MARCH)
#
# Generic linker script for statically linked binaries
#
@@ -123,6 +124,13 @@ LD_CMD += -Wl,--dynamic-linker=$(DYNAMIC_LINKER).lib.so \
#
FILTER_DEPS := $(filter-out $(BASE_LIBS),$(DEPS:.lib=))
SHARED_LIBS += $(LIB_CACHE_DIR)/$(DYNAMIC_LINKER)/$(DYNAMIC_LINKER).lib.so
#
# Build program position independent as well
#
CC_OPT_PIC ?= -fPIC
CC_OPT += $(CC_OPT_PIC)
endif
#