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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to