Эх сурвалжийг харах

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

radek.tandler 2 жил өмнө
parent
commit
58d6216956
2 өөрчлөгдсөн 12 нэмэгдсэн , 6 устгасан
  1. 4 5
      CMakeLists.txt
  2. 8 1
      Kconfig

+ 4 - 5
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,

+ 8 - 1
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