13627105546 opened a new pull request, #17878: URL: https://github.com/apache/nuttx/pull/17878
Add CONFIG_NET_NO_LTO to allow compiling the network stack with -fno-lto. This is useful for avoiding LTO-related issues in the network layer. *Note: Please adhere to [Contributing Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).* ## Summary This PR adds a new Kconfig option `CONFIG_NET_NO_LTO` to control Link Time Optimization (LTO) specifically for the network subsystem. When enabled, it appends `-fno-lto` to the compilation flags for network files in `net/Makefile` and `net/CMakeLists.txt`. This change is necessary because in some build environments or specific architectures, enabling LTO globally can cause issues within the network stack (e.g., stack overflow due to aggressive inlining, symbol visibility problems, or excessive build times). Providing a granular control allows users to keep LTO enabled for the rest of the system while disabling it for the network layer if needed. ## Impact * **Impact on user**: Users can now optionally disable LTO for the network stack via `menuconfig` -> `Networking Support` -> `Support no-lto option for the network Makefile`. * **Build process**: If `CONFIG_NET_NO_LTO=y`, the `-fno-lto` flag is added to the CFLAGS for network sources. * **Compatibility**: Backward compatible; default is `n` (disabled), preserving existing behavior. ## Testing * **Verification**: 1. Configured with `CONFIG_NET_NO_LTO=y`. 2. Verified via `make --dry-run` that `-fno-lto` appears in the compilation commands for files under `net/`. 3. Configured with `CONFIG_NET_NO_LTO=n`. 4. Verified that `-fno-lto` is absent. 5. Passed `tools/checkpatch.sh`. -- 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]
