casaroli commented on PR #20723: URL: https://github.com/apache/nuttx/pull/20723#issuecomment-6274757307
Thank you for these two points. Both were real, and both are fixed now. **1. `CONFIG_DEBUG_LINK_WHOLE_ARCHIVE`.** You are right: `--whole-archive` in `LDFLAGS` also applied to the toolchain libraries, so every object of libgcc was linked, also `emutls.o`. The new commit "arch: Link the toolchain libraries without --whole-archive." puts `--no-whole-archive` before libgcc, libm, libsupc++, libstdc++ and libgcov, and `--whole-archive` after them, in every `Toolchain.defs` that has the option (with `-Xlinker` when gcc links). CMake puts `-Wl,--no-whole-archive` before the extra libraries. So libc keeps the real names and there is no `--wrap`. Kernel-build programs and modules link libc's functions by their names, as before. The NuttX objects of the image do not change: only the unused libgcc objects go. Test with `DEBUG_OPT_UNUSED_SECTIONS` and `DEBUG_LINK_WHOLE_ARCHIVE` (`lm3s6965-ek:nsh` fails on master already with `multiple definition of up_idle`, so I used other boards): | Configuration | master | PR before | PR now | |---|---|---|---| | `qemu-armv7a:nsh`, Arm GNU 13.2 and 15.3 | links | `multiple definition of __emutls_get_address` | links | | `mps2-an500:nsh`, Arm GNU 13.2 and 15.3 | links | `multiple definition of __emutls_get_address` | links | | `qemu-armv7a:nsh`, CMake, 13.2 | links | `multiple definition of __emutls_get_address` | links | | `rv-virt:nsh`, riscv-none-elf 14.3 | links | `multiple definition of __emutls_get_address` | links | **2. The types of `struct __emutls_object`.** You are right here too, and CI proved it: apps #3880 (which depends on this PR) failed on every AVR configuration with `conflicting types for built-in function '__emutls_register_common'`, because on AVR `word` is 1 byte and `size_t` is 2. The control object and `__emutls_register_common()` now use libgcc's types: `unsigned int __attribute__((mode(word)))` and `mode(pointer)`, as GCC declares its built-in. Also, a new hidden option `CONFIG_TLS_EMUTLS` builds this code only for GCC and clang, and not on 8-bit AVR, which has no atomic pointer loads. -- 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]
