toolchain: cmake: Off-tree toolchains gets other.h included if selected
To ensure that an off-tree toolchain gets the toolchain/other.h header included, such that it can include the correct header for the toolchain via the other.h, the define __TOOLCHAIN_CUSTOM__ will be set when ever the cmake flag TOOLCHAIN_USE_CUSTOM is set. An off-tree toolchain needs to set the set(TOOLCHAIN_USE_CUSTOM 1) in the off-tree generic.cmake and/or target.cmake, in order for the include/other.h to be included. The generic.cmake and target.cmake will be under ${TOOLCHAIN_ROOT}/cmake/toolchain/${ZEPHYR_TOOLCHAIN_VARIANT}/ As the TOOLCHAIN_USE_CUSTOM is only set for off-tree toolchains, this has no impact on in-tree toolchains and their functionality. Fixes zephyrproject-rtos#36117 Signed-off-by: Danny Oerndrup <daor@demant.com>
This commit is contained in:
parent
51f2022f7b
commit
94202f3ed7
|
@ -95,6 +95,11 @@ zephyr_compile_definitions(
|
|||
__ZEPHYR__=1
|
||||
)
|
||||
|
||||
# Ensure that include/toolchain.h includes toolchain/other.h for all off-tree toolchains
|
||||
if(TOOLCHAIN_USE_CUSTOM)
|
||||
zephyr_compile_definitions(__TOOLCHAIN_CUSTOM__)
|
||||
endif()
|
||||
|
||||
# @Intent: Set compiler flags to enable buffer overflow checks in libc functions
|
||||
# @config in CONFIG_NO_OPTIMIZATIONS optional : Optimizations may affect security
|
||||
zephyr_compile_definitions($<TARGET_PROPERTY:compiler,security_fortify> )
|
||||
|
|
|
@ -33,7 +33,12 @@
|
|||
#define HAS_BUILTIN(x) HAS_BUILTIN_##x
|
||||
#endif
|
||||
|
||||
#if defined(__XCC__)
|
||||
#if defined(__TOOLCHAIN_CUSTOM__)
|
||||
/* This include line exists for off-tree definitions of compilers,
|
||||
* and therefore this header is not meant to exist in-tree
|
||||
*/
|
||||
#include <toolchain/other.h>
|
||||
#elif defined(__XCC__)
|
||||
#include <toolchain/xcc.h>
|
||||
#elif defined(__CCAC__)
|
||||
#include <toolchain/mwdt.h>
|
||||
|
@ -42,10 +47,7 @@
|
|||
#elif defined(__GNUC__) || (defined(_LINKER) && defined(__GCC_LINKER_CMD__))
|
||||
#include <toolchain/gcc.h>
|
||||
#else
|
||||
/* This include line exists for off-tree definitions of compilers,
|
||||
* and therefore this header is not meant to exist in-tree
|
||||
*/
|
||||
#include <toolchain/other.h>
|
||||
#error "Invalid/unknown toolchain configuration"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue