diff --git a/CMakeLists.txt b/CMakeLists.txt index c6b61ae061..6de3173992 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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, diff --git a/Kconfig b/Kconfig index ab8c76d910..c0924cc767 100644 --- a/Kconfig +++ b/Kconfig @@ -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