casaroli opened a new pull request, #20383: URL: https://github.com/apache/nuttx/pull/20383
## Summary Every NXFLAT module imports the ABI marker `__nxflat_abi_v2`, and the loader resolves it against the symbol table `exec()` is given, like any other import (#19600). The marker was defined in `binfmt/libnxflat`, which works in a flat build, where firmware and applications are one image. In a protected build the table comes from the application, in the user image, which cannot see a kernel symbol. The user image fails to link with `undefined reference to '__nxflat_abi_v2'` as soon as an application generates its table from the modules' imports, as `examples/nxflat` does. A kernel build has the same problem, with one image per process. This defines the marker in libc instead, which every one of those images links. The first commit is whitespace only: it fixes the 37 older nxstyle errors in `libnxflat_bind.c`, which the check would otherwise report because the second commit touches the file. ## Impact Only `CONFIG_NXFLAT` builds change. In a flat build the marker moves from `binfmt` to `libc` in the same image. In a protected or kernel build each image that links libc now has it. ## Testing `mps3-an547:knsh` (protected) under QEMU with `CONFIG_NXFLAT` and `examples/nxflat`: on master the user image fails to link on `__nxflat_abi_v2`; with this change it links, and errno, hello, mutex, pthread and struct run. (`CONFIG_UNWINDER_ARM` has to be off for the modules to build at all; that is a separate `ldnxflat` issue.) `lm3s6965-ek:qemu-nxflat` (flat) under QEMU still runs every module to `End-of-Test`. `tools/checkpatch.sh -c -u -m -g` passes. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
