380198c985
Provided changes add option (CONFIG_EXECFUNCS_GENERATE_SYSTEM_SYMTAB) to build complete list of available functions and syscalls automatically. The symbolic table is generated in form libsymtab.a which can be reused by application or directly pull in when "g_symtab" and "g_nsymbols" variables are requested by EXECFUNCS configuration. I have tried to follow mechanisms for library compilation in different kernel protection modes but tested only flat no-MMU build. The basic assumption is that this library and libraries providing syscall stubs and C-library functions are available in user-space context and initial application (usually NSH) registers the symbol table through IOCTL. The table can be reused then by another applications in their address space as kernel allows. Simple for flat or protected mode, I am not sure if really support in MMU mode. It is highly probable that I have made some mistake, overlooked something, but functionality is optional (should not cause troubles in any mode if disabled) and main purpose is to lower memory overhead when more applications are loaded on memory constrained system which usually use direct kernel calling without protection or address space separation. If the table should be provided by kernel to applications then makefiles has to be adjusted.
121 lines
4.7 KiB
Plaintext
121 lines
4.7 KiB
Plaintext
#
|
|
# For a description of the syntax of this configuration file,
|
|
# see the file kconfig-language.txt in the NuttX tools repository.
|
|
#
|
|
|
|
menu "Program Execution Options"
|
|
|
|
config LIBC_EXECFUNCS
|
|
bool "Enable exec[l|v] / posix_spawn() Support"
|
|
default n
|
|
depends on !BINFMT_DISABLE
|
|
---help---
|
|
Enable support for the exec[l|v] family of functions that can be
|
|
used to start other programs, terminating the current program and
|
|
the posix_spawn() familty of functions that can be used start other
|
|
programs without terminating the current program. The typical
|
|
usage of the exec[l|v] functions is (1) first call vfork() to create
|
|
a new thread, then (2) call exec[l|v] to replace the new thread with
|
|
a program from the file system.
|
|
|
|
NOTE 1: This two step process start is completely unnecessary in
|
|
NuttX and is provided only for compatibily with Unix systems. These
|
|
functions are essentially just wrapper functions that (1) call the
|
|
non-standard binfmt function 'exec', and then (2) exit(0). Since
|
|
the new thread will be terminated by the exec[l|v] call, it really
|
|
served no purpose other than to suport Unix compatility.
|
|
|
|
The posix_spawn() functions do not have this inefficiency.
|
|
|
|
NOTE 2: Support for exec[l|v] and posix_spawn() is conditional
|
|
because they require additional support for symbol tables that
|
|
will not be available in the typical system.
|
|
|
|
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 may select this
|
|
option in order to use it. Symbol tables are required in most
|
|
cases in order to link executable programs to the base code.
|
|
|
|
NOTE: This option only pre-initializes the system symbol table as
|
|
defined by CONFIG_EXECFUNCS_SYMTAB_ARRAY and CONFIG_EXECFUNCS_NSYMBOLS_VAR.
|
|
This is simply an optional, automatic initialization of the
|
|
system symbol table. You would need to do this, for example, in
|
|
in the kernel build were the first task must be run from a program
|
|
on the file system. This option has no other effect.
|
|
|
|
Optionally, you can always call binfmt_setsymtab() from your
|
|
board-specific logic or, equivalently, call boardctl(BOARDIOC_APP_SYMTAB)
|
|
from your application initialization logic.
|
|
|
|
if EXECFUNCS_HAVE_SYMTAB
|
|
config EXECFUNCS_SYMTAB_ARRAY
|
|
string "Symbol table name used by exec[l|v]"
|
|
default "g_symtab"
|
|
---help---
|
|
The exec[l|v] and posix_spawn() functions are wrapper functions that
|
|
call the non-standard binfmt function 'exec'). The binfmt
|
|
function 'exec' needs to have (1) a symbol table that provides the
|
|
list of symbols exported by the base code, and (2) the number of
|
|
symbols in that table. This selection provides the name of that
|
|
symbol table.
|
|
|
|
config EXECFUNCS_NSYMBOLS_VAR
|
|
string "Name of variable holding the number of symbols"
|
|
default "g_nsymbols"
|
|
---help---
|
|
The exec[l|v] and posix_spawn() functions are wrapper functions that
|
|
call the non-standard binfmt function 'exec'). The binfmt
|
|
function 'exec' needs to have (1) a symbol table that provides the
|
|
list of symbols exported by the base code, and (2) the number of
|
|
symbols in that table. This selection provides the name of an 'int'
|
|
variable that contains the number of symbols in the symbol table.
|
|
|
|
config EXECFUNCS_GENERATE_SYSTEM_SYMTAB
|
|
bool "Generate and include system symbol table"
|
|
default n
|
|
---help---
|
|
Generate symbol table which includes symbols for all available
|
|
syscalls, libc and libm functions. It makes system significantly
|
|
larger but actual applications can reuse maximum from the system
|
|
image.
|
|
|
|
The symbol table array is named g_symtab and variable holding
|
|
number of exported symbols g_nsymbols. It matches expected defaults
|
|
from entries above. But they can be changed and generated symbol table
|
|
can be used as template by application.
|
|
endif # EXECFUNCS_HAVE_SYMTAB
|
|
endif # LIBC_EXECFUNCS
|
|
|
|
config POSIX_SPAWN_PROXY_STACKSIZE
|
|
int "Spawn Stack Size"
|
|
default 1024
|
|
---help---
|
|
If posix_spawn[p]() and task_spawn() use I/O redirection options,
|
|
they will require an intermediary/proxy task to muck with the file
|
|
descriptors. This configuration item specifies the stack size
|
|
used for the proxy. Default: 1024 bytes.
|
|
|
|
config TASK_SPAWN_DEFAULT_STACKSIZE
|
|
int "Default task_spawn Stack Size"
|
|
default 2048
|
|
depends on !ARCH_ADDRENV
|
|
---help---
|
|
The actual size to use for the child task's stack can be set with
|
|
task_spawnattr_setstacksize(). This value specifies the default
|
|
stack size to use if task_spawnattr_setstacksize() is not used.
|
|
Default: 2048.
|
|
|
|
endmenu # Program Execution Options
|
|
|
|
config LIB_HOSTNAME
|
|
string "Host name for this device"
|
|
default ""
|
|
---help---
|
|
A unique name to identify device on the network
|