nuttx/cmake
Marco Casaroli 77f263b4fa cmake: Build FDPIC modules the way the make build does.
The same two differences as in common/Toolchain.defs: the compiler is told
-mfdpic -fPIC, and the module link is done by an arm-uclinuxfdpiceabi
linker.

That linker is not the one that links the firmware, so the module link needs
a variable of its own.  CMAKE_ELF_LD is the ordinary linker unless the
architecture sets it, which arm does under CONFIG_FDPIC.

The linker script needs nothing here: it is generated from
libs/libc/elf/gnu-elf.ld.in, which both build systems preprocess, and the
FDPIC segments are already in it.

-r is now conditional on CONFIG_PIC being off, which is what
common/Toolchain.defs has always done and the cmake build did not: a
position independent module is linked as an executable, and an FDPIC one as
a shared object, so neither wants it.

-fno-use-cxa-atexit mirrors CXXELFFLAGS for the same reason it was added
there.

Configured and built mps3-an547:picostest with CONFIG_FDPIC through cmake and
ninja: the modules in bin/ are ARM FDPIC with two PT_LOAD segments.

Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
2026-09-09 10:21:21 +08:00
..
menuconfig.cmake cmake: Use NUTTX(_DIR/_BIN_DIR) instead CMAKE(_SRC_DIR/_BIN_DIR) 2026-08-09 11:13:08 -03:00
nuttx_3rdparty.cmake cmake: Moved the creation of the nxtmpdir folder to the root CMake file 2026-04-22 06:22:36 +08:00
nuttx_add_application.cmake cmake: Build FDPIC modules the way the make build does. 2026-09-09 10:21:21 +08:00
nuttx_add_dependencies.cmake style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
nuttx_add_library.cmake cmake: parse EXTRAFLAGS with separate_arguments. 2026-09-01 09:19:27 +08:00
nuttx_add_module.cmake cmake: migrate to SPDX identifier 2024-09-10 11:34:40 +08:00
nuttx_add_romfs.cmake sched,fs,docs: support setuid sudo helper 2026-08-18 15:57:52 +08:00
nuttx_add_subdirectory.cmake cmake: pass exclusion list to nuttx_add_subdirectory 2025-10-03 11:34:56 +08:00
nuttx_add_symtab.cmake cmake: Use NUTTX(_DIR/_BIN_DIR) instead CMAKE(_SRC_DIR/_BIN_DIR) 2026-08-09 11:13:08 -03:00
nuttx_create_symlink.cmake cmake: nuttx_create_symlink: Remove warning for CMP0205 2026-05-26 15:11:35 -03:00
nuttx_export_header.cmake cmake: Use NUTTX(_DIR/_BIN_DIR) instead CMAKE(_SRC_DIR/_BIN_DIR) 2026-08-09 11:13:08 -03:00
nuttx_extensions.cmake cmake: Use NUTTX(_DIR/_BIN_DIR) instead CMAKE(_SRC_DIR/_BIN_DIR) 2026-08-09 11:13:08 -03:00
nuttx_generate_headers.cmake cmake: Use NUTTX(_DIR/_BIN_DIR) instead CMAKE(_SRC_DIR/_BIN_DIR) 2026-08-09 11:13:08 -03:00
nuttx_generate_outputs.cmake cmake: Use NUTTX(_DIR/_BIN_DIR) instead CMAKE(_SRC_DIR/_BIN_DIR) 2026-08-09 11:13:08 -03:00
nuttx_generate_sim_ld.cmake cmake: Use NUTTX(_DIR/_BIN_DIR) instead CMAKE(_SRC_DIR/_BIN_DIR) 2026-08-09 11:13:08 -03:00
nuttx_kconfig.cmake Revert "cmake: normalize .config on reconfigure" 2026-08-13 07:54:00 +02:00
nuttx_mkconfig.cmake cmake: Use NUTTX(_DIR/_BIN_DIR) instead CMAKE(_SRC_DIR/_BIN_DIR) 2026-08-09 11:13:08 -03:00
nuttx_mkversion.cmake cmake: Use NUTTX(_DIR/_BIN_DIR) instead CMAKE(_SRC_DIR/_BIN_DIR) 2026-08-09 11:13:08 -03:00
nuttx_multiple_link.cmake cmake: Use NUTTX(_DIR/_BIN_DIR) instead CMAKE(_SRC_DIR/_BIN_DIR) 2026-08-09 11:13:08 -03:00
nuttx_overrides.cmake cmake(bugfix):change default compile obj extension to .o 2026-01-27 20:54:26 +08:00
nuttx_parse_function_args.cmake cmake: migrate to SPDX identifier 2024-09-10 11:34:40 +08:00
nuttx_process_config.cmake cmake: Use NUTTX(_DIR/_BIN_DIR) instead CMAKE(_SRC_DIR/_BIN_DIR) 2026-08-09 11:13:08 -03:00
nuttx_redefine_symbols.cmake cmake: Use NUTTX(_DIR/_BIN_DIR) instead CMAKE(_SRC_DIR/_BIN_DIR) 2026-08-09 11:13:08 -03:00
nuttx_remove_compile_options.cmake style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
nuttx_sethost.cmake cmake: Use NUTTX(_DIR/_BIN_DIR) instead CMAKE(_SRC_DIR/_BIN_DIR) 2026-08-09 11:13:08 -03:00
nuttx_source_file_properties.cmake cmake: migrate to SPDX identifier 2024-09-10 11:34:40 +08:00
nuttx_toolchain.cmake cmake: Use NUTTX(_DIR/_BIN_DIR) instead CMAKE(_SRC_DIR/_BIN_DIR) 2026-08-09 11:13:08 -03:00
savedefconfig.cmake sched,fs,docs: support setuid sudo helper 2026-08-18 15:57:52 +08:00
symtab.c.in cmake: migrate to SPDX identifier 2024-09-10 11:34:40 +08:00