xiaoxiang781216 commented on code in PR #14472:
URL: https://github.com/apache/nuttx/pull/14472#discussion_r1814488707


##########
arch/arm/src/common/Toolchain.defs:
##########
@@ -445,14 +445,18 @@ endif
 
 # Add the builtin library
 
-COMPILER_RT_LIB = $(shell $(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name)
-ifeq ($(CONFIG_ARCH_TOOLCHAIN_CLANG),y)
-  ifeq ($(wildcard $(COMPILER_RT_LIB)),)
-    # if "--print-libgcc-file-name" unable to find the correct libgcc PATH
-    # then go ahead and try "--print-file-name"
-    COMPILER_RT_LIB := $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) 
--print-file-name $(notdir $(COMPILER_RT_LIB))))
+ifeq ($(CONFIG_BUILTIN_COMPILER_RT),)

Review Comment:
   ```suggestion
   ifeq ($(CONFIG_BUILTIN_TOOLCHAIN),y)
   ```



##########
libs/libbuiltin/Kconfig:
##########
@@ -0,0 +1,32 @@
+#
+# For a description of the syntax of this configuration file,
+# see the file kconfig-language.txt in the NuttX tools repository.
+#
+
+comment "Toolchain Library Support"
+
+choice
+       prompt "Builtin toolchain support"
+       default BUILTIN_NONE
+       ---help---
+               Choose to compile libraries related to toolchain into the OS
+
+config BUILTIN_COMPILER_RT
+       bool "Builtin LLVM Compiler-rt"
+       ---help---
+               Compile the LLVM Compiler-rt library into the OS.
+
+config BUILTIN_NONE

Review Comment:
   ```suggestion
   config BUILTIN_TOOLCHAIN
   ```



##########
tools/Directories.mk:
##########
@@ -90,6 +96,12 @@ else
 CLEANDIRS += libs$(DELIM)libm
 endif
 
+ifeq ($(CONFIG_BUILTIN_NONE),)

Review Comment:
   ```suggestion
   ifeq ($(CONFIG_BUILTIN_TOOLCHAIN),)
   ```



##########
arch/arm/src/cmake/clang.cmake:
##########
@@ -237,11 +237,17 @@ set(PREPROCESS ${CMAKE_C_COMPILER} ${CMAKE_C_FLAG_ARGS} 
-E -P -x c)
 
 set(NUTTX_FIND_TOOLCHAIN_LIB_DEFINED true)
 
-function(nuttx_find_toolchain_lib)
-  execute_process(
-    COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAG_ARGS} ${NUTTX_EXTRA_FLAGS}
-            --print-file-name
-    OUTPUT_STRIP_TRAILING_WHITESPACE
-    OUTPUT_VARIABLE extra_lib_path)
-  nuttx_add_extra_library(${extra_lib_path})
-endfunction()
+if(CONFIG_BUILTIN_COMPILER_RT)

Review Comment:
   ```suggestion
   if(CONFIG_BUILTIN_TOOLCHAIN)
   ```



##########
tools/Directories.mk:
##########
@@ -90,6 +96,12 @@ else
 CLEANDIRS += libs$(DELIM)libm
 endif
 
+ifeq ($(CONFIG_BUILTIN_NONE),)

Review Comment:
   move before line 92



##########
arch/arm/src/cmake/clang.cmake:
##########
@@ -237,11 +237,17 @@ set(PREPROCESS ${CMAKE_C_COMPILER} ${CMAKE_C_FLAG_ARGS} 
-E -P -x c)
 
 set(NUTTX_FIND_TOOLCHAIN_LIB_DEFINED true)
 
-function(nuttx_find_toolchain_lib)
-  execute_process(
-    COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAG_ARGS} ${NUTTX_EXTRA_FLAGS}
-            --print-file-name
-    OUTPUT_STRIP_TRAILING_WHITESPACE
-    OUTPUT_VARIABLE extra_lib_path)
-  nuttx_add_extra_library(${extra_lib_path})
-endfunction()
+if(CONFIG_BUILTIN_COMPILER_RT)
+  function(nuttx_find_toolchain_lib)
+
+  endfunction()
+else()
+  function(nuttx_find_toolchain_lib)

Review Comment:
   but it affects all extra library 



##########
arch/arm/src/cmake/clang.cmake:
##########
@@ -237,11 +237,13 @@ set(PREPROCESS ${CMAKE_C_COMPILER} ${CMAKE_C_FLAG_ARGS} 
-E -P -x c)
 
 set(NUTTX_FIND_TOOLCHAIN_LIB_DEFINED true)
 
-function(nuttx_find_toolchain_lib)
-  execute_process(
-    COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAG_ARGS} ${NUTTX_EXTRA_FLAGS}
-            --print-file-name
-    OUTPUT_STRIP_TRAILING_WHITESPACE
-    OUTPUT_VARIABLE extra_lib_path)
-  nuttx_add_extra_library(${extra_lib_path})
-endfunction()
+if(NOT CONFIG_BUILTIN_COMPILER_RT)

Review Comment:
   ```suggestion
   if(CONFIG_BUILTIN_TOOLCHAIN)
   ```



##########
tools/FlatLibs.mk:
##########
@@ -75,6 +75,12 @@ ifeq ($(CONFIG_BUILD_2PASS),y)
 NUTTXLIBS += staging$(DELIM)libpass1$(LIBEXT)
 endif
 
+# Add toolchain library support

Review Comment:
   move before line 53



##########
libs/libbuiltin/Kconfig:
##########
@@ -0,0 +1,32 @@
+#
+# For a description of the syntax of this configuration file,
+# see the file kconfig-language.txt in the NuttX tools repository.
+#
+
+comment "Toolchain Library Support"
+
+choice
+       prompt "Builtin toolchain support"
+       default BUILTIN_NONE

Review Comment:
   ```suggestion
        default BUILTIN_TOOLCHAIN
   ```



##########
tools/ProtectedLibs.mk:
##########
@@ -52,6 +52,13 @@ NUTTXLIBS += staging$(DELIM)libkmm$(LIBEXT) 
staging$(DELIM)libkarch$(LIBEXT)
 USERLIBS  += staging$(DELIM)libproxies$(LIBEXT) staging$(DELIM)libc$(LIBEXT)
 USERLIBS  += staging$(DELIM)libmm$(LIBEXT) staging$(DELIM)libarch$(LIBEXT)
 
+# Add toolchain library support
+
+ifeq ($(CONFIG_BUILTIN_NONE),)

Review Comment:
   ```suggestion
   ifeq ($(CONFIG_BUILTIN_TOOLCHAIN),)
   ```



##########
tools/Directories.mk:
##########
@@ -74,6 +74,12 @@ else
 CLEANDIRS += libs$(DELIM)libm
 endif
 
+ifeq ($(CONFIG_BUILTIN_NONE),)

Review Comment:
   ```suggestion
   ifeq ($(CONFIG_BUILTIN_TOOLCHAIN),)
   ```



##########
tools/KernelLibs.mk:
##########
@@ -72,6 +72,13 @@ ifeq ($(CONFIG_HAVE_CXX),y)
 USERLIBS += staging$(DELIM)libxx$(LIBEXT)
 endif
 
+# Add toolchain library support
+
+ifeq ($(CONFIG_BUILTIN_NONE),)

Review Comment:
   ```suggestion
   ifeq ($(CONFIG_BUILTIN_TOOLCHAIN),)
   ```



##########
tools/Directories.mk:
##########
@@ -74,6 +74,12 @@ else
 CLEANDIRS += libs$(DELIM)libm
 endif
 
+ifeq ($(CONFIG_BUILTIN_NONE),)

Review Comment:
   move before line 70



##########
libs/libbuiltin/.gitignore:
##########
@@ -0,0 +1,3 @@
+/compiler-rt/compiler-rt

Review Comment:
   no change



##########
tools/KernelLibs.mk:
##########
@@ -72,6 +72,13 @@ ifeq ($(CONFIG_HAVE_CXX),y)
 USERLIBS += staging$(DELIM)libxx$(LIBEXT)
 endif
 
+# Add toolchain library support

Review Comment:
   move before line 55



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to