cmake: set minimal C++ linker properties in minimal C++ CMake impl

The property based toolchain integration allows a cleaner design by
letting the toolchain define its properties and values and let CMake
implementation of Zephyr provided C and C++ libraries adjust those
properties when minimal C or C++ libraries are used.

This commit moves handling of C++ linker library properties into
the minimal C++ CMake implementation.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
This commit is contained in:
Torsten Rasmussen 2024-10-30 11:56:14 +01:00 committed by Anas Nashif
parent 44d96a2668
commit d2896df821
5 changed files with 6 additions and 4 deletions

View File

@ -16,7 +16,6 @@ if(NOT CONFIG_NATIVE_BUILD)
endif()
if(CONFIG_CPP
AND NOT CONFIG_MINIMAL_LIBCPP
AND NOT CONFIG_NATIVE_LIBRARY
# When new link principle is fully introduced, then the below condition can
# be removed, and instead the external module c++ should use:

View File

@ -7,7 +7,7 @@
# and adjust for lld specifics afterwards.
include(${ZEPHYR_BASE}/cmake/linker/ld/linker_flags.cmake OPTIONAL)
if(NOT CONFIG_MINIMAL_LIBCPP AND NOT CONFIG_NATIVE_LIBRARY AND NOT CONFIG_EXTERNAL_MODULE_LIBCPP)
if(NOT CONFIG_NATIVE_LIBRARY AND NOT CONFIG_EXTERNAL_MODULE_LIBCPP)
set_property(TARGET linker PROPERTY cpp_base ${LINKERFLAGPREFIX},-z,norelro)
endif()

View File

@ -8,7 +8,6 @@ set_linker_property(NO_CREATE TARGET linker PROPERTY rt_library "")
set_linker_property(TARGET linker PROPERTY c++_library "-lc++;-lc++abi")
if(CONFIG_CPP
AND NOT CONFIG_MINIMAL_LIBCPP
AND NOT CONFIG_NATIVE_LIBRARY
# When new link principle is fully introduced, then the below condition can
# be removed, and instead the external module c++ should use:

View File

@ -7,7 +7,7 @@ check_set_linker_property(TARGET linker PROPERTY base
${LINKERFLAGPREFIX},--build-id=none
)
if(NOT CONFIG_MINIMAL_LIBCPP AND NOT CONFIG_NATIVE_LIBRARY AND NOT CONFIG_EXTERNAL_MODULE_LIBCPP)
if(NOT CONFIG_NATIVE_LIBRARY AND NOT CONFIG_EXTERNAL_MODULE_LIBCPP)
set_property(TARGET linker PROPERTY cpp_base -lstdc++)
endif()

View File

@ -1,5 +1,9 @@
# SPDX-License-Identifier: Apache-2.0
# Clear the toolchain defined C++ library property when using minimal C++ lib.
set_linker_property(PROPERTY c++_library "")
set_linker_property(PROPERTY cpp_base "")
zephyr_system_include_directories(include)
zephyr_sources(