nuttx/tools/nxflat
Marco Casaroli 295f0e373c tools/nxflat: Leave ARM unwind tables out of an NXFLAT module.
CONFIG_UNWINDER_ARM compiles everything with -funwind-tables, modules
included, so each module carries .ARM.exidx and .ARM.extab.  The NXFLAT
link scripts do not name them, and ldnxflat placed them in D-Space, where
the first R_ARM_PREL31 entry stopped the conversion:

  ldnxflat: arm relocation 42 at D-Space 00000018 is not handled

That relocation cannot be handled: an exidx entry is an offset from itself
to a function in I-Space, and the distance between the two segments is only
known when the loader places them.  Nothing unwinds through a module
either, since the unwinder only reads the firmware's own table.

So ldnxflat leaves both sections out of the images, and with them the
relocations against them, as it already does for sections it does not
place.  A module without unwind tables converts exactly as before.

On mps3-an547:nsh under QEMU with CONFIG_UNWINDER_ARM and examples/nxflat,
the modules failed to convert; now they convert and errno, hello, mutex,
pthread and struct run.  The eleven modules of tools/nxflat/testsuite.sh
convert to the same bytes as before.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
2026-09-28 16:45:09 -03:00
..
dyncall_skeleton_arm.def !arch/arm: Use r9 as the PIC base register. 2026-08-06 01:38:23 +08:00
dyncall_skeleton_thumb2.def !arch/arm: Use r9 as the PIC base register. 2026-08-06 01:38:23 +08:00
ldnxflat.c tools/nxflat: Leave ARM unwind tables out of an NXFLAT module. 2026-09-28 16:45:09 -03:00
mknxflat.c tools/nxflat: Split the ELF reader out of mknxflat. 2026-09-27 11:25:12 -03:00
nxflat_elf.c tools/nxflat: Split the ELF reader out of mknxflat. 2026-09-27 11:25:12 -03:00
nxflat_elf.h tools/nxflat: Split the ELF reader out of mknxflat. 2026-09-27 11:25:12 -03:00
nxflat_thunk.h !arch/arm: Use r9 as the PIC base register. 2026-08-06 01:38:23 +08:00
testsuite.sh tools/nxflat: Add a driver for the NXFLAT test suite. 2026-09-27 11:25:12 -03:00
thunk_arm.c !arch/arm: Use r9 as the PIC base register. 2026-08-06 01:38:23 +08:00
thunk_thumb2.c !arch/arm: Use r9 as the PIC base register. 2026-08-06 01:38:23 +08:00