casaroli opened a new pull request, #21436: URL: https://github.com/apache/nuttx/pull/21436
## Summary Since #21368, `atexit()` is not built with `CONFIG_LIBC_MAX_EXITFUNS=0`, the default. A C++ ELF program is built with `-fno-use-cxa-atexit`, so a static object with a destructor calls `atexit()`: with GCC a static object in a function, with Clang every static object. So `nucleo-h743zi:elf`, the one ELF and C++ configuration that CI builds with Clang, does not link, and `Linux (arm-stm32h7)` is red on every PR that runs it: ``` ld.lld: error: undefined symbol: atexit >>> referenced by test_symtab.c ``` This makes 1 the default of `CONFIG_LIBC_MAX_EXITFUNS` when both `CONFIG_ELF` and `CONFIG_HAVE_CXX` are enabled. A configuration can still set 0 when its ELF programs have no static objects. `sim:loadable` already had this value, so its defconfig drops the line. ## Impact Configurations with ELF and C++ and no value of their own (42 in the tree) get `atexit()` and one entry in the task information. `crt0` then registers `exec_dtors` with `atexit()`, so the destructors also run when a program calls `exit()`. Other configurations do not change. ## Testing `nucleo-h743zi:elf` on macOS: | Tree | Compiler | `LIBC_MAX_EXITFUNS` | Result | |---|---|---|---| | master | Clang | 0 | `undefined symbol: atexit` | | this PR | Clang | 1 | no `atexit` error | | master | GCC | 0 | links | | this PR | GCC | 1 | links | Homebrew Clang has no Arm runtime library, so the Clang link stops on `__aeabi_*` symbols in both trees: only the `atexit` error is compared, and CI checks the complete link. `make savedefconfig` gives the same defconfig for `sim:loadable` and `nucleo-h743zi:elf` (apart from the host lines). -- 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]
