From 8f30804e05db1b6b9eab064e4bb621a26b612230 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 12 Sep 2014 12:48:22 -0600 Subject: [PATCH] Having a symbol table is an option. There are no symbol tables with CONFIG_BUILD_KERNEL, for example. --- configs/sim/nsh/defconfig | 1 + configs/stm32f4discovery/posix_spawn/defconfig | 1 + libc/Kconfig | 11 +++++++++++ libc/unistd/lib_execsymtab.c | 7 +++++++ 4 files changed, 20 insertions(+) diff --git a/configs/sim/nsh/defconfig b/configs/sim/nsh/defconfig index 263a28303a..1523139b8b 100644 --- a/configs/sim/nsh/defconfig +++ b/configs/sim/nsh/defconfig @@ -409,6 +409,7 @@ CONFIG_LIB_RAND_ORDER=1 # CONFIG_EOL_IS_BOTH_CRLF is not set CONFIG_EOL_IS_EITHER_CRLF=y CONFIG_LIBC_EXECFUNCS=y +CONFIG_EXECFUNCS_HAVE_SYMTAB=y CONFIG_EXECFUNCS_SYMTAB="g_symtab" CONFIG_EXECFUNCS_NSYMBOLS=0 CONFIG_POSIX_SPAWN_PROXY_STACKSIZE=1024 diff --git a/configs/stm32f4discovery/posix_spawn/defconfig b/configs/stm32f4discovery/posix_spawn/defconfig index a8e0be0b55..ccce94eaf5 100644 --- a/configs/stm32f4discovery/posix_spawn/defconfig +++ b/configs/stm32f4discovery/posix_spawn/defconfig @@ -609,6 +609,7 @@ CONFIG_LIB_RAND_ORDER=1 # CONFIG_EOL_IS_BOTH_CRLF is not set CONFIG_EOL_IS_EITHER_CRLF=y CONFIG_LIBC_EXECFUNCS=y +CONFIG_EXECFUNCS_HAVE_SYMTAB=y CONFIG_EXECFUNCS_SYMTAB="exports" CONFIG_EXECFUNCS_NSYMBOLS=10 CONFIG_POSIX_SPAWN_PROXY_STACKSIZE=1024 diff --git a/libc/Kconfig b/libc/Kconfig index 79b7cbc0f6..e11e0a7ccc 100644 --- a/libc/Kconfig +++ b/libc/Kconfig @@ -107,6 +107,16 @@ config LIBC_EXECFUNCS if LIBC_EXECFUNCS +config EXECFUNCS_HAVE_SYMTAB + bool "Have symbol table" + default n if BUILD_KERNEL + default y if !BUILD_KERNEL + ---help--- + If you have a system symbol table, then you must select this + option in order to use it. Symbol tables are required in most + cases in order to like executable programs to the base code. + +if EXECFUNCS_HAVE_SYMTAB config EXECFUNCS_SYMTAB string "Symbol table used by exec[l|v]" default "g_symtab" @@ -129,6 +139,7 @@ config EXECFUNCS_NSYMBOLS symbols in that table. This selection provides the number of symbols in the symbol table. +endif # EXECFUNCS_HAVE_SYMTAB endif # LIBC_EXECFUNCS config POSIX_SPAWN_PROXY_STACKSIZE diff --git a/libc/unistd/lib_execsymtab.c b/libc/unistd/lib_execsymtab.c index 34b798bb4a..35df4c059f 100644 --- a/libc/unistd/lib_execsymtab.c +++ b/libc/unistd/lib_execsymtab.c @@ -69,14 +69,21 @@ * Public Variables ****************************************************************************/ +#ifdef CONFIG_EXECFUNCS_HAVE_SYMTAB extern const struct symtab_s CONFIG_EXECFUNCS_SYMTAB; +#endif /**************************************************************************** * Private Data ****************************************************************************/ +#ifdef CONFIG_EXECFUNCS_HAVE_SYMTAB static FAR const struct symtab_s *g_exec_symtab = &CONFIG_EXECFUNCS_SYMTAB; static int g_exec_nsymbols = CONFIG_EXECFUNCS_NSYMBOLS; +#else +static FAR const struct symtab_s *g_exec_symtab; +static int g_exec_nsymbols; +#endif /**************************************************************************** * Public Functions