nuttx/binfmt
Marco Casaroli 9f1107862b binfmt, arch/arm: Add the CONFIG_FDPIC option and the ABI header.
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>
2026-09-08 16:31:16 -03:00
..
libnxflat !arch/arm: Use r9 as the PIC base register. 2026-08-06 01:38:23 +08:00
binfmt.h fs/binfmt: Enforce POSIX execute permissions prior to binary load 2026-06-13 21:07:01 +08:00
binfmt_checkexec.c sched: add supplementary group IDs (setgroups/getgroups/initgroups) 2026-08-12 16:06:03 -03:00
binfmt_copyactions.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
binfmt_copyargv.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
binfmt_dumpmodule.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
binfmt_exec.c fs/binfmt: Enforce POSIX execute permissions prior to binary load 2026-06-13 21:07:01 +08:00
binfmt_execmodule.c fs/binfmt: close symlink TOCTOU and harden setuid/setgid exec hygiene 2026-08-01 15:32:03 -03:00
binfmt_execsymtab.c sched: binfmt remove csection 2026-01-11 20:44:35 +08:00
binfmt_exit.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
binfmt_globals.c binfmt: migrate to SPDX identifier 2024-09-10 11:34:18 +08:00
binfmt_initialize.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
binfmt_loadmodule.c fs/binfmt: Enforce POSIX execute permissions prior to binary load 2026-06-13 21:07:01 +08:00
binfmt_register.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
binfmt_unloadmodule.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
binfmt_unregister.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
builtin.c fs/binfmt: Enforce POSIX execute permissions prior to binary load 2026-06-13 21:07:01 +08:00
CMakeLists.txt cmake: Use NUTTX(_DIR/_BIN_DIR) instead CMAKE(_SRC_DIR/_BIN_DIR) 2026-08-09 11:13:08 -03:00
elf.c elf:use elf symbol to parse attribute 2026-07-15 12:24:44 -03:00
Kconfig binfmt, arch/arm: Add the CONFIG_FDPIC option and the ABI header. 2026-09-08 16:31:16 -03:00
Makefile tools: fix stale archive members surviving a Kconfig-driven CSRCS change 2026-07-28 21:26:03 -03:00
nxflat.c fs/binfmt: Enforce POSIX execute permissions prior to binary load 2026-06-13 21:07:01 +08:00