From 389ac36f20252438a5615120ae4944cc8705702f Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Sat, 28 Sep 2019 11:17:01 -0600 Subject: [PATCH] libs/libc: Add CONFIG_MODLIB_SYSTEM_SYMTAB to generate the symbol table for dlopen/insmod. --- libs/libc/.gitignore | 1 + libs/libc/Makefile | 11 +++++++++++ libs/libc/modlib/Kconfig | 4 ++++ 3 files changed, 16 insertions(+) diff --git a/libs/libc/.gitignore b/libs/libc/.gitignore index 83663b26db..75a441eb21 100644 --- a/libs/libc/.gitignore +++ b/libs/libc/.gitignore @@ -2,6 +2,7 @@ /Make_ubin.dep /Make_kbin.dep /exec_symtab.c +/modlib_symtab.c /.depend /*.lib diff --git a/libs/libc/Makefile b/libs/libc/Makefile index 846752edfc..7142ba22b2 100644 --- a/libs/libc/Makefile +++ b/libs/libc/Makefile @@ -126,6 +126,17 @@ CSRCS += exec_symtab.c endif +ifeq ($(CONFIG_MODLIB_SYSTEM_SYMTAB),y) + +modlib_symtab.c : $(CSVFILES) $(MKSYMTAB) + $(Q) cat $(CSVFILES) | LC_ALL=C sort >$@.csv + $(Q) $(MKSYMTAB) $@.csv $@ $(CONFIG_MODLIB_SYMTAB_ARRAY) $(CONFIG_MODLIB_NSYMBOLS_VAR) + $(Q) rm -f $@.csv + +CSRCS += modlib_symtab.c + +endif + # REVISIT: Backslash causes problems in $(COBJS) target DELIM := $(strip /) BINDIR ?= bin diff --git a/libs/libc/modlib/Kconfig b/libs/libc/modlib/Kconfig index a650ad019b..28b11e7f51 100644 --- a/libs/libc/modlib/Kconfig +++ b/libs/libc/modlib/Kconfig @@ -91,6 +91,10 @@ config MODLIB_NSYMBOLS_VAR default "g_mod_nsymbols" if !EXECFUNCS_HAVE_SYMTAB default EXECFUNCS_NSYMBOLS_VAR if EXECFUNCS_HAVE_SYMTAB +config MODLIB_SYSTEM_SYMTAB + bool "Generate the system symbol table" + default n + endif # MODLIB_HAVE_SYMTAB endmenu # Module library configuration