build: fixed unwanted libgcc when building using clang for linux target

This commit is contained in:
radek.tandler 2023-06-14 16:40:04 +02:00
parent 6f4ee07b69
commit 58d6216956
2 changed files with 12 additions and 6 deletions

View File

@ -224,11 +224,10 @@ endif()
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
list(APPEND compile_options "-fno-use-cxa-atexit")
if(CONFIG_COMPILER_RT_LIB_GCCLIB)
list(APPEND link_options "-rtlib=libgcc")
elseif(CONFIG_COMPILER_RT_LIB_CLANGRT)
list(APPEND link_options "-rtlib=compiler-rt")
endif()
endif()
if(COMPILER_RT_LIB_NAME)
list(APPEND link_options "-rtlib=${CONFIG_COMPILER_RT_LIB_NAME}")
endif()
# For the transition period from 32-bit time_t to 64-bit time_t,

View File

@ -514,23 +514,30 @@ mainmenu "Espressif IoT Development Framework Configuration"
choice COMPILER_RT_LIB
prompt "Compiler runtime library"
default COMPILER_RT_LIB_CLANGRT if IDF_TOOLCHAIN_CLANG
default COMPILER_RT_LIB_HOST if IDF_TARGET_LINUX
default COMPILER_RT_LIB_GCCLIB
help
Select runtime library to be used by compiler.
- GCC toolchain supports libgcc only.
- Clang allows to choose between libgcc or libclang_rt.
- For host builds ("linux" target), uses the default library.
config COMPILER_RT_LIB_GCCLIB
depends on !IDF_TARGET_LINUX
bool "libgcc"
config COMPILER_RT_LIB_CLANGRT
depends on IDF_TOOLCHAIN_CLANG
depends on IDF_TOOLCHAIN_CLANG && !IDF_TARGET_LINUX
bool "libclang_rt"
config COMPILER_RT_LIB_HOST
depends on IDF_TARGET_LINUX
bool "Host"
endchoice
config COMPILER_RT_LIB_NAME
string
default "clang_rt.builtins" if COMPILER_RT_LIB_CLANGRT
default "gcc" if COMPILER_RT_LIB_GCCLIB
default "" if COMPILER_RT_LIB_HOST
endmenu # Compiler Options