[PATCH] D13131: Allow the builting of the builtins library with a forced compiler.

Vasileios Kalintiris via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 30 06:07:07 PDT 2015


vkalintiris updated this revision to Diff 38798.
vkalintiris added a comment.

Update test_target_arch macro to recognize <arch> as supported when we
want to build the builtins library with a forced C compiler.


http://reviews.llvm.org/D13131

Files:
  cmake/config-ix.cmake

Index: cmake/config-ix.cmake
===================================================================
--- cmake/config-ix.cmake
+++ cmake/config-ix.cmake
@@ -102,22 +102,30 @@
 # flags to verify that:
 #   1) <def> is defined (if non-empty)
 #   2) simple file can be successfully built.
-# If successful, saves target flags for this architecture.
+# If successful, saves target flags for this architecture. When we build only
+# the builtins library, we assume that <arch> is supported if it's equal to the
+# compiler-rt's default target architecture and the C compiler is forced by the
+# user.
 macro(test_target_arch arch def)
-  set(TARGET_${arch}_CFLAGS ${ARGN})
-  set(argstring "")
-  foreach(arg ${ARGN})
-    set(argstring "${argstring} ${arg}")
-  endforeach()
-  check_compile_definition("${def}" "${argstring}" HAS_${arch}_DEF)
-  if(NOT HAS_${arch}_DEF)
-    set(CAN_TARGET_${arch} FALSE)
+  if (CMAKE_C_COMPILER_FORCED AND NOT COMPILER_RT_BUILD_SANITIZERS AND
+      COMPILER_RT_DEFAULT_TARGET_ARCH STREQUAL "${arch}")
+    set(CAN_TARGET_${arch} TRUE)
   else()
-    set(argstring "${CMAKE_EXE_LINKER_FLAGS} ${argstring}")
-    try_compile(CAN_TARGET_${arch} ${CMAKE_BINARY_DIR} ${SIMPLE_SOURCE}
-                COMPILE_DEFINITIONS "${TARGET_${arch}_CFLAGS}"
-                OUTPUT_VARIABLE TARGET_${arch}_OUTPUT
-                CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS:STRING=${argstring}")
+    set(TARGET_${arch}_CFLAGS ${ARGN})
+    set(argstring "")
+    foreach(arg ${ARGN})
+      set(argstring "${argstring} ${arg}")
+    endforeach()
+    check_compile_definition("${def}" "${argstring}" HAS_${arch}_DEF)
+    if(NOT HAS_${arch}_DEF)
+      set(CAN_TARGET_${arch} FALSE)
+    else()
+      set(argstring "${CMAKE_EXE_LINKER_FLAGS} ${argstring}")
+      try_compile(CAN_TARGET_${arch} ${CMAKE_BINARY_DIR} ${SIMPLE_SOURCE}
+                  COMPILE_DEFINITIONS "${TARGET_${arch}_CFLAGS}"
+                  OUTPUT_VARIABLE TARGET_${arch}_OUTPUT
+                  CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS:STRING=${argstring}")
+    endif()
   endif()
   if(${CAN_TARGET_${arch}})
     list(APPEND COMPILER_RT_SUPPORTED_ARCH ${arch})


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13131.38798.patch
Type: text/x-patch
Size: 2150 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151030/d0a42bab/attachment.bin>


More information about the llvm-commits mailing list