You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "casaroli (via GitHub)" <gi...@apache.org> on 2026/10/19 13:15:10 UTC

[PR] build: Find the compiler runtime of the module compiler. [nuttx-apps]

casaroli opened a new pull request, #3885:
URL: https://github.com/apache/nuttx-apps/pull/3885

   ## Summary
   
   `FIND_COMPILER_RT_LIB` asks `$(CC)` for the compiler runtime of a loadable module, but the module is built with `$(MODULECC)`. On macOS the simulator builds its modules with an ELF toolchain (`MODULECC = x86_64-elf-gcc` in `boards/sim/sim/sim/scripts/Make.defs`), while `$(CC)` is the host clang. So the module link gets the Mach-O `libclang_rt.osx.a`, and no module links:
   
   ```
   x86_64-elf-ld: .../libclang_rt.osx.a: file not recognized: file format not recognized
   make[3]: *** [apps/bin/hello] Error 1
   ```
   
   This PR asks `$(MODULECC)`. `tools/Config.mk` sets `MODULECC ?= $(CC)`, and only the macOS simulator sets another compiler, so the other builds do not change.
   
   ## Impact
   
   macOS simulator with `CONFIG_MODULES` and a tristate app set to `m`: the module links with the libgcc of `x86_64-elf-gcc` and loads. No change for the other builds.
   
   ## Testing
   
   `sim:nsh` with `CONFIG_ELF`, `CONFIG_EXECFUNCS_SYSTEM_SYMTAB`, `CONFIG_SIM_HOSTFS` and `CONFIG_EXAMPLES_HELLO=m`; `hello` loaded from hostfs:
   
   | Host | master | this PR |
   |---|---|---|
   | macOS, x86_64 simulator (Rosetta), x86_64-elf-gcc 16.2 modules | link fails (`libclang_rt.osx.a: file format not recognized`) | `Hello, World!!` |
   | Linux x86_64 (Debian 12, gcc 12) | `Hello, World!!` | `Hello, World!!`, module byte-identical |
   
   The macOS test needs nuttx apache/nuttx#20807 (`get_environ_ptr` in libc.csv). The Linux test turns off `CONFIG_COVERAGE_ALL`: with it, every module refers to `__gcov_init`, which the symbol table does not export.
   
   `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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] build: Find the compiler runtime of the module compiler. [nuttx-apps]

Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis merged PR #3885:
URL: https://github.com/apache/nuttx-apps/pull/3885


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org