ld: generate symbol map from base/lib/symbols/ld

This patch removes the manually maintained symbol map from the dynamic
linker. This way, the symbol map stays in sync with the ABI and - more
importantly - no longer uses wildcards. So the symbols exported by the
dynamic linker are strictly limited by the ABI.

Issue #2190
This commit is contained in:
Norman Feske 2016-12-23 12:57:29 +01:00
parent 5c186cdc1d
commit 9ea4a491d6
3 changed files with 12 additions and 102 deletions

View File

@ -11,7 +11,18 @@ SRC_CC = main.cc test.cc exception.cc dependency.cc debug.cc \
SRC_S = jmp_slot.s
INC_DIR += $(DIR)/include
INC_DIR += $(BASE_DIR)/src/include
LD_OPT += -Bsymbolic-functions --version-script=$(DIR)/symbol.map
LD_OPT += -Bsymbolic-functions --version-script=symbol.map
#
# Generate symbol map from the ABI
#
$(LIB).lib.so: symbol.map
symbol.map: $(MAKEFILE_LIST)
symbol.map: $(BASE_DIR)/lib/symbols/ld
$(MSG_CONVERT)$@
$(VERBOSE)(echo -e "{\n\tglobal:";\
sed -n "s/^\(\w\+\) .*/\t\t\1;/p" $<;\
echo -e "\tlocal: *;\n};") > $@
ifneq ($(filter linux, $(SPECS)),)

View File

@ -19,7 +19,6 @@ SYMBOLS := $(BASE_DIR)/lib/symbols/ld
SHARED_LIB := yes
LD_OPT += -Bsymbolic-functions --version-script=$(BASE_DIR)/src/lib/ldso/symbol.map
LD_OPT += -T$(BASE_DIR)/src/lib/ldso/linker.ld
symbols.s: $(MAKEFILE_LIST)

View File

@ -1,100 +0,0 @@
/*
* Symbols exported by the ld.lib.so
*/
{
global:
/* We export all C++ symbols with prefix Genode::, as well as all vtables,
* type informations and operators new and delete
*/
extern "C++" {
Genode::*;
*typeinfo*;
vtable*;
init_exception_handling*;
operator*new*;
operator*delete*;
genode_atexit*;
genode_exit*;
genode___cxa_finalize*;
genode_envp;
genode_argv;
genode_argc;
};
__dynamic_cast;
/*
* Symbols for calls generated by the compiler (i.e., on ARM), and
* provided by the C++ runtime.
*/
memcpy;
memset;
memmove;
/*
* Debugging
*/
wait_for_continue;
stdout_write;
stdout_reconnect;
/* Testing */
extern "C++" {
__ldso_raise_exception*;
};
/* GNU verbose terminate handler */
extern "C++" { __gnu_cxx::__verbose_terminate_handler*; };
extern "C++" { std::terminate*; };
extern "C++" { std::bad_exception*; };
extern "C++" { std::exception*; };
extern "C++" { std::uncaught_exception*; };
/* x86 */
__cxa*;
_Unwind_Complete;
_Unwind_DeleteException;
_Unwind_Resume;
__gxx_personality_v0;
dl_iterate_phdr;
/* ARM */
__aeabi_*;
dl_unwind_find_exidx;
/*
* Kernel specific symbols
*/
/* Fiasco.OC */
l4_utcb_wrap;
__l4_sys_direct_sycalls;
l4_atomic_cmpxchg;
extern "C++" {
main_thread_utcb*;
};
/* Linux */
lx_syscall;
/* Linux hybrid */
lx_environ;
/* Base HW */
extern "C++" {
Kernel::*;
};
/* Pistachio */
__L4_ThreadSwitch;
__L4_Ipc;
local:
/*
* Everything else is local
*/
*;
};