casaroli opened a new pull request, #21721: URL: https://github.com/apache/nuttx/pull/21721
## Summary `libs/libc/libc.csv` gives the functions of the system symbol table (`CONFIG_EXECFUNCS_SYSTEM_SYMTAB`, `CONFIG_LIBC_ELF_SYSTEM_SYMTAB`), which loadable modules link against. Some rows have a wrong condition, so some builds with the symbol table do not build on master. Two commits: 1. Fix the conditions of twelve rows. `fileno()`, `fscanf()`, `getc()`, `flockfile()`, `ftrylockfile()`, `funlockfile()` and `lib_get_stream()` are built only with `CONFIG_FILE_STREAM` (the three lock functions had the inverse condition): without it the link fails with `undefined reference to 'fileno'`. `CONFIG_TLS_TASK_NELEM` does not exist in a kernel build: `task_tls_get_value()` and `task_tls_set_value()` gave `"CONFIG_TLS_TASK_NELEM" is not defined, evaluates to 0 [-Werror=undef]`; they now use the condition of `task_tls_alloc()`. `daemon()` and `exit()` are not built in the kernel part of a protected build and `scandir()` is built only outside the kernel: `undefined reference to 'daemon'` in `libkc.a`. 2. Export `getopt_long()` and `getopt_long_only()`: `getopt.h` declares them and libc builds them, but a module that calls them does not load (`Exported symbol "getopt_long" not found`). ## Impact - Only `libs/libc/libc.csv` changes. Builds without `CONFIG_EXECFUNCS_SYSTEM_SYMTAB` and `CONFIG_LIBC_ELF_SYSTEM_SYMTAB` do not use the file. - With the symbol table: the configurations above build again; the table has two more entries, and the image links `getopt_long()` and `getopt_long_only()`. - No ABI, Kconfig or code change. No documentation change: `Documentation/os/libs/libc/index.rst` describes the format of the file, not its rows. ## Testing Builds (`make`, aarch64-none-elf 14.2 and arm-none-eabi 15.3), master 3117ab10467 and this PR: | Configuration | master | this PR | |---|---|---| | `qemu-armv8a:knsh` (kernel) + `LIBC_ELF_SYSTEM_SYMTAB` | FAIL: `"CONFIG_TLS_TASK_NELEM" is not defined` | PASS | | `mps2-an500:knsh` (protected) + `EXECFUNCS_SYSTEM_SYMTAB` | FAIL: `undefined reference to 'daemon'`, `'exit'`, `'scandir'` (`libkc.a`) | PASS | | `qemu-armv8a:nsh` (flat) + `EXECFUNCS_SYSTEM_SYMTAB`, no `FILE_STREAM` (`dd` and `ostest` off: they need streams) | FAIL: `undefined reference to 'fileno'`, `'flockfile'`, `'fscanf'`, `'ftrylockfile'`, `'funlockfile'`, `'getc'`, `'lib_get_stream'` | PASS | | `lx_cpu:nsh` (defconfig with `EXECFUNCS_SYSTEM_SYMTAB`, small flash) | PASS | PASS | Run: flat `qemu-armv8a:nsh` (QEMU HVF) with `ELF` and `EXECFUNCS_SYSTEM_SYMTAB`, and an ELF module from a 9p share that calls `getopt_long()` and `getopt_long_only()`: - master: `Exported symbol "getopt_long" not found`, the module does not load. - this PR: the module loads and both functions parse their options. `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]
