[PATCH] D31218: [compiler-rt] build compiler-rt runtimes without LTO

Bob Haarman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 21 16:01:43 PDT 2017


inglorion updated this revision to Diff 92563.
inglorion added a comment.

added comment, as suggested by @davidxl


https://reviews.llvm.org/D31218

Files:
  cmake/Modules/AddCompilerRT.cmake


Index: cmake/Modules/AddCompilerRT.cmake
===================================================================
--- cmake/Modules/AddCompilerRT.cmake
+++ cmake/Modules/AddCompilerRT.cmake
@@ -110,6 +110,13 @@
     "OS;ARCHS;SOURCES;CFLAGS;LINK_FLAGS;DEFS;LINK_LIBS;OBJECT_LIBS"
     ${ARGN})
   set(libnames)
+  # Until we support this some other way, build compiler-rt runtime without LTO
+  # to allow non-LTO projects to link with it.
+  if(COMPILER_RT_HAS_FNO_LTO_FLAG)
+    set(NO_LTO_FLAGS "-fno-lto")
+  else()
+    set(NO_LTO_FLAGS "")
+  endif()
   if(APPLE)
     foreach(os ${LIB_OS})
       if(type STREQUAL "STATIC")
@@ -121,7 +128,7 @@
       list_intersect(LIB_ARCHS_${libname} DARWIN_${os}_ARCHS LIB_ARCHS)
       if(LIB_ARCHS_${libname})
         list(APPEND libnames ${libname})
-        set(extra_cflags_${libname} ${DARWIN_${os}_CFLAGS} ${LIB_CFLAGS})
+        set(extra_cflags_${libname} ${DARWIN_${os}_CFLAGS} ${NO_LTO_FLAGS} ${LIB_CFLAGS})
         set(output_name_${libname} ${libname}${COMPILER_RT_OS_SUFFIX})
         set(sources_${libname} ${LIB_SOURCES})
         format_object_libs(sources_${libname} ${os} ${LIB_OBJECT_LIBS})
@@ -149,7 +156,7 @@
       set(sources_${libname} ${LIB_SOURCES})
       format_object_libs(sources_${libname} ${arch} ${LIB_OBJECT_LIBS})
       set(libnames ${libnames} ${libname})
-      set(extra_cflags_${libname} ${TARGET_${arch}_CFLAGS} ${LIB_CFLAGS})
+      set(extra_cflags_${libname} ${TARGET_${arch}_CFLAGS} ${NO_LTO_FLAGS} ${LIB_CFLAGS})
     endforeach()
   endif()
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31218.92563.patch
Type: text/x-patch
Size: 1532 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170321/3f6ad274/attachment.bin>


More information about the llvm-commits mailing list