mirror of
https://github.com/apache/nuttx.git
synced 2026-09-12 13:40:14 +00:00
The commits that follow teach the ELF loader to load an FDPIC object. This puts the option they hang off and the definitions they share in one place first, so each of them builds on its own. CONFIG_FDPIC depends on ARCH_HAVE_ELF_FDPIC, which an architecture selects when it has a PIC base register and the FDPIC relocations. Only armv7-m and armv8-m select it today, and it defaults off, so nothing changes for anyone who does not ask for it. include/nuttx/fdpic.h holds what both sides of the loader need: the two word function descriptor an FDPIC module passes instead of a code address, the test for whether the caller is such a module, and the call sequence that enters one with its own data base. All of it is behind CONFIG_FDPIC, thus the header is empty without it and a file may include it unconditionally. The call sequence itself is architecture specific, so arch/arm/include/arch.h supplies it as up_fdpic_invoke(), beside the other PIC base register macros. up_setpicbase() cannot serve here: the register has to hold the module's base for exactly one call and then go back, and nothing in C tells the compiler the register is live across that call, so the save, the install, the branch and the restore have to be one sequence. Built for mps3-an547:bl and mps3-an547:picostest, with CONFIG_FDPIC off, which is every configuration in the tree. Assisted-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
129 lines
3.5 KiB
Text
129 lines
3.5 KiB
Text
#
|
|
# For a description of the syntax of this configuration file,
|
|
# see the file kconfig-language.txt in the NuttX tools repository.
|
|
#
|
|
|
|
config BINFMT_DISABLE
|
|
bool "Disable BINFMT support"
|
|
default DEFAULT_SMALL
|
|
---help---
|
|
By default, support for loadable binary formats is built. This logic
|
|
may be suppressed by defining this setting.
|
|
|
|
if !BINFMT_DISABLE
|
|
|
|
config PATH_INITIAL
|
|
string "Initial PATH Value"
|
|
default ""
|
|
depends on LIBC_ENVPATH
|
|
---help---
|
|
The initial value of the PATH variable. This is the colon-separated
|
|
list of absolute paths. E.g., "/bin:/usr/bin:/sbin"
|
|
|
|
config BINFMT_LOADABLE
|
|
bool
|
|
select MODULES
|
|
default n
|
|
---help---
|
|
Automatically selected if a loadable binary format is selected.
|
|
|
|
config PIC
|
|
bool "Executable elf position-independent support"
|
|
default n
|
|
---help---
|
|
Automatically selected if the binary format requires position
|
|
independent operation.
|
|
|
|
config NXFLAT
|
|
bool "Enable the NXFLAT Binary Format"
|
|
default n
|
|
select BINFMT_LOADABLE
|
|
select PIC
|
|
---help---
|
|
Enable support for the NXFLAT binary format. Default: n
|
|
|
|
if NXFLAT
|
|
source "binfmt/libnxflat/Kconfig"
|
|
endif
|
|
|
|
config ELF
|
|
bool "Enable the ELF Binary Format"
|
|
default n
|
|
select BINFMT_LOADABLE
|
|
select LIBC_ELF
|
|
---help---
|
|
Enable support for the ELF binary format. Default: n
|
|
|
|
if ELF
|
|
config ELF_STACKSIZE
|
|
int "ELF Stack Size"
|
|
default DEFAULT_TASK_STACKSIZE
|
|
---help---
|
|
This is the default stack size that will be used when starting ELF binaries.
|
|
|
|
config FDPIC
|
|
bool "FDPIC modules"
|
|
default n
|
|
select PIC
|
|
depends on ARCH_HAVE_ELF_FDPIC
|
|
---help---
|
|
Load ELF modules built for the FDPIC ABI.
|
|
|
|
An FDPIC module places its read-only and writable segments
|
|
independently, so its text can be executed directly out of flash
|
|
while only the writable segment is copied to RAM, once per running
|
|
instance. A filesystem that can show its media, such as XIPFS or
|
|
ROMFS, gives that result. On any other filesystem the loader copies
|
|
the text to RAM, and the module runs but shares nothing.
|
|
|
|
Building a module needs an arm-uclinuxfdpiceabi linker. The stock
|
|
arm-none-eabi compiler emits correct FDPIC objects for both C and
|
|
C++, so only the link needs it.
|
|
|
|
What this adds over the position independent ELF support already
|
|
present is a function pointer that carries its own data base, as a
|
|
two word descriptor rather than a bare code address. That is what
|
|
lets a module be called back on a thread it did not create, such as
|
|
the work queue worker that runs a SIGEV_THREAD notification.
|
|
|
|
Selecting this makes ten libc and sched entry points that can
|
|
accept a callback from a module resolve such a descriptor before
|
|
storing or branching to it. Each costs a register read and a
|
|
branch on a path that is not hot.
|
|
|
|
This implementation covers ARM Thumb-2.
|
|
endif
|
|
endif
|
|
|
|
config BINFMT_CONSTRUCTORS
|
|
bool "C++ Static Constructor Support"
|
|
default n
|
|
depends on HAVE_CXX && ELF
|
|
---help---
|
|
Built-in support for C++ constructors in loaded modules. Currently
|
|
only support for ELF binary formats.
|
|
|
|
choice
|
|
prompt "File output format"
|
|
default BINFMT_ELF_RELOCATABLE
|
|
---help---
|
|
Defines the type of ELF file produced by the NuttX build system.
|
|
|
|
config BINFMT_ELF_RELOCATABLE
|
|
bool "Relocatable ELF"
|
|
---help---
|
|
Produce a relocatable object as output. This is also known as partial linking.
|
|
|
|
config BINFMT_ELF_EXECUTABLE
|
|
bool "Executable ELF"
|
|
depends on ARCH_HAVE_ELF_EXECUTABLE
|
|
---help---
|
|
Produce a full linked executable object as output.
|
|
|
|
endchoice
|
|
|
|
config BINFMT_STORE_FILENAME
|
|
bool "Store the binary filename"
|
|
default n
|
|
---help---
|
|
Store the filename of the loaded binary
|