mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-21 22:47:50 +00:00
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:
parent
1aadce4496
commit
b8beba5bf3
@ -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
|
||||
|
||||
#
|
||||
|
@ -125,7 +125,6 @@ static int rtld_dirname(const char *, char *);
|
||||
static void rtld_exit(void);
|
||||
static char *search_library_path(const char *, const char *);
|
||||
static const void **get_program_var_addr(const char *);
|
||||
static void set_program_var(const char *, const void *);
|
||||
static const Elf_Sym *symlook_default(const char *, unsigned long,
|
||||
const Obj_Entry *, const Obj_Entry **, const Ver_Entry *, int);
|
||||
static const Elf_Sym *symlook_list(const char *, unsigned long, const Objlist *,
|
||||
@ -2429,7 +2428,7 @@ get_program_var_addr(const char *name)
|
||||
* is used to set key variables such as "environ" before any of the
|
||||
* init functions are called.
|
||||
*/
|
||||
static void
|
||||
void
|
||||
set_program_var(const char *name, const void *value)
|
||||
{
|
||||
const void **addr;
|
||||
|
@ -272,6 +272,7 @@ void *allocate_module_tls(int index);
|
||||
bool allocate_tls_offset(Obj_Entry *obj);
|
||||
void free_tls_offset(Obj_Entry *obj);
|
||||
const Ver_Entry *fetch_ventry(const Obj_Entry *obj, unsigned long);
|
||||
void set_program_var(const char *name, const void *value);
|
||||
|
||||
/*
|
||||
* MD function declarations.
|
||||
|
Loading…
Reference in New Issue
Block a user