casaroli opened a new pull request, #20489: URL: https://github.com/apache/nuttx/pull/20489
## Summary With `CONFIG_EXECFUNCS_SYSTEM_SYMTAB`, the make build generates `exec_symtab.c` from `libc.csv`, `libm.csv` and `syscall.csv` with the host tool `mksymtab` (`libs/libc/Makefile`). `CONFIG_LIBC_ELF_SYSTEM_SYMTAB` does the same for `elf_sys_symtab.c`. The CMake build did neither, so a CMake configuration with one of these options did not link: ``` binfmt/binfmt_execsymtab.c:127: undefined reference to `g_symtab' binfmt/binfmt_execsymtab.c:127: undefined reference to `g_nsymbols' ``` This PR does the same in `libs/libc/CMakeLists.txt`: it builds `mksymtab` as a host tool with `nuttx_build_host_target()`, sorts the three lists by name, generates the table with the configured array and count names, and adds it to the C library. `mksymtab` runs in the build directory with relative names, so the output is the same as from the make build. This came up in review of apache/nuttx#20132, which documents that a CMake configuration needs the table from elsewhere. That note goes once this merges. ## Impact CMake builds with `CONFIG_EXECFUNCS_SYSTEM_SYMTAB` or `CONFIG_LIBC_ELF_SYSTEM_SYMTAB`. No change to the make build or to CMake builds without these options. ## Testing Host: macOS arm64, Arm GNU Toolchain 13.2.rel1, CMake with Ninja. `mps2-an500:xipfs` with `CONFIG_ELF`, `CONFIG_LIBC_EXECFUNCS`, `CONFIG_EXECFUNCS_HAVE_SYMTAB` and `CONFIG_EXECFUNCS_SYSTEM_SYMTAB`: | build | result | |---|---| | CMake, master | link fails, `undefined reference to g_symtab` | | CMake, this PR | links; `exec_symtab.c` is byte-identical to the one the make build generates (699 symbols) | `mps2-an500:xipfs` with `CONFIG_LIBC_ELF_HAVE_SYMTAB`, `CONFIG_LIBC_ELF_SYSTEM_SYMTAB` and the names `g_elf_symtab`/`g_elf_nsymbols`: links, and `nm` shows both symbols. The CMake image boots to NSH under QEMU. `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]
