keep LTO option off by default

This commit is contained in:
Robin Müller 2022-05-10 11:19:29 +02:00
parent eb0223bc51
commit 0fe1b70bae
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
2 changed files with 19 additions and 8 deletions

View File

@ -49,6 +49,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- LTO support: Allow using LTO/IPO by setting `FSFW_ENABLE_LTO=1`. CMake is able to detect whether
the user compiler supports IPO/LPO. LTO is on by default now. Most modern compilers support it,
can make good use of it and it usually makes the code faster and/or smaller.
After some more research:
Enabling LTO will actually cause the compiler to only produce thin LTO by adding
`-flto -fno-fat-lto-objects` to the compiler options. I am not sure this is an ideal choice
because if an application linking against the FSFW does not use LTO, there can be compile
issues (e.g. observed when compiling the FSFW tests without LTO). This is a known issue as
can be seen in the multiple CMake issues for it:
- https://gitlab.kitware.com/cmake/cmake/-/issues/22913,
- https://gitlab.kitware.com/cmake/cmake/-/issues/16808,
- https://gitlab.kitware.com/cmake/cmake/-/issues/21696
Easiest solution for now: Keep this option OFF by default.
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/616
- Linux HAL: Add wiretapping option for I2C. Enabled with `FSFW_HAL_I2C_WIRETAPPING` defined to 1
- Dedicated Version class and constant `fsfw::FSFW_VERSION` containing version information

View File

@ -17,11 +17,12 @@ set(FSFW_REVISION 0)
# Add the cmake folder so the FindSphinx module is found
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
set(FSFW_ETL_LIB_NAME etl)
set(FSFW_ETL_LIB_MAJOR_VERSION 20 CACHE STRING
"ETL library major version requirement"
"ETL library major version requirement"
)
set(FSFW_ETL_LIB_VERSION ${FSFW_ETL_LIB_MAJOR_VERSION}.27.3 CACHE STRING
"ETL library exact version requirement"
"ETL library exact version requirement"
)
set(FSFW_ETL_LINK_TARGET etl::etl)
@ -32,26 +33,26 @@ set(FSFW_CATCH2_LIB_VERSION v${FSFW_CATCH2_LIB_MAJOR_VERSION}.0.0-preview5 CACHE
"Catch2 library exact version requirement"
)
set(FSFW_ETL_LIB_NAME etl)
include(CheckIPOSupported)
check_ipo_supported(RESULT IPO_SUPPORTED OUTPUT IPO_ERROR)
if(NOT IPO_SUPPORTED)
message(STATUS "FSFW | IPO/LTO not supported: ${IPO_ERROR}")
endif()
option(FSFW_ENABLE_IPO "Enable interprocedural optimization or link-time optimization if available" ON)
# Keep this off by default for now. See PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/616
# for information which keeping this on by default is problematic
option(FSFW_ENABLE_IPO "Enable interprocedural optimization or link-time optimization if available" OFF)
option(FSFW_GENERATE_SECTIONS
"Generate function and data sections. Required to remove unused code" ON
"Generate function and data sections. Required to remove unused code" ON
)
if(FSFW_GENERATE_SECTIONS)
option(FSFW_REMOVE_UNUSED_CODE "Remove unused code" ON)
option(FSFW_REMOVE_UNUSED_CODE "Remove unused code" ON)
endif()
option(FSFW_BUILD_UNITTESTS "Build unittest binary in addition to static library" OFF)
option(FSFW_BUILD_DOCS "Build documentation with Sphinx and Doxygen" OFF)
if(FSFW_BUILD_UNITTESTS)
option(FSFW_TESTS_GEN_COV "Generate coverage data for unittests" ON)
option(FSFW_TESTS_GEN_COV "Generate coverage data for unittests" ON)
endif()
option(FSFW_WARNING_SHADOW_LOCAL_GCC "Enable -Wshadow=local warning in GCC" ON)