casaroli opened a new pull request, #20360:
URL: https://github.com/apache/nuttx/pull/20360
## Summary
Part of the FDPIC series. `[5.5/10]` #19940 taught the ELF module path what
an FDPIC object is, so an application built as a module gets `-mfdpic -fPIC`
and the `arm-uclinuxfdpiceabi` linker, and comes out a shared object the loader
can bind.
The loadable module path was left behind. `apps/Application.mk` reaches it
with `DYNLIB = y`, `apps/Library.mk` builds every shared library with it, and
it is still a `-r` partial link with the stock linker. Such an object has no
dynamic section, so nothing can bind an import to it, and there is no way to
build a library an FDPIC module can call.
So `CMODULEFLAGS` and `CXXMODULEFLAGS` gain the same compiler flags, and
`LDMODULEFLAGS` links a shared object rather than a partial one. The entry
point stays with the caller, because a module is entered at `_start` while a
library is only ever called into.
`CXXMODULEFLAGS` is defined here for the first time. `apps/Library.mk`
compiles every C++ source of a shared library with it and no architecture ever
defined it, so those sources were compiled with no architecture flags at all.
apache/nuttx-apps#3762 is the first user: its module fixtures stop
hand-rolling the link and use these variables.
## Impact
Everything else is under `CONFIG_FDPIC`, which defaults off and is
selectable only where `ARCH_HAVE_ELF_FDPIC` is set.
`CXXMODULEFLAGS` replaces nothing, since it was empty.
## Testing
Compiled and linked a library with the variables this patch produces, taken
from a `pimoroni-pico-2-plus` tree configured with `CONFIG_FDPIC`:
```
$ arm-uclinuxfdpiceabi-readelf -dh libcounter.so
OS/ABI: ARM FDPIC
Type: DYN (Shared object file)
Entry point: 0x0
0x0e (SONAME) Library soname: [libcounter.so]
```
Two `PT_LOAD` segments, `R E` and `RW`, as an FDPIC object needs.
`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]