[PATCH] D23638: [compiler-rt] Don't build ubsan cxxabi sources when unused

Francis Ricci via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 22 13:35:26 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL279467: [compiler-rt] Don't build ubsan cxxabi sources when unused (authored by fjricci).

Changed prior to commit:
  https://reviews.llvm.org/D23638?vs=68464&id=68901#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D23638

Files:
  compiler-rt/trunk/lib/ubsan/CMakeLists.txt

Index: compiler-rt/trunk/lib/ubsan/CMakeLists.txt
===================================================================
--- compiler-rt/trunk/lib/ubsan/CMakeLists.txt
+++ compiler-rt/trunk/lib/ubsan/CMakeLists.txt
@@ -12,7 +12,7 @@
   ubsan_init_standalone.cc
   )
 
-set(UBSAN_CXX_SOURCES
+set(UBSAN_CXXABI_SOURCES
   ubsan_handlers_cxx.cc
   ubsan_type_hash.cc
   ubsan_type_hash_itanium.cc
@@ -39,7 +39,7 @@
 if(APPLE)
   set(UBSAN_COMMON_SOURCES ${UBSAN_SOURCES})
   if(SANITIZER_CAN_USE_CXXABI)
-    list(APPEND UBSAN_COMMON_SOURCES ${UBSAN_CXX_SOURCES})
+    list(APPEND UBSAN_COMMON_SOURCES ${UBSAN_CXXABI_SOURCES})
   endif()
 
   # Common parts of UBSan runtime.
@@ -73,7 +73,16 @@
   add_compiler_rt_object_libraries(RTUbsan
     ARCHS ${UBSAN_COMMON_SUPPORTED_ARCH}
     SOURCES ${UBSAN_SOURCES} CFLAGS ${UBSAN_CFLAGS})
-  # C++-specific parts of UBSan runtime. Requires a C++ ABI library.
+
+  if(SANITIZER_CAN_USE_CXXABI)
+    # C++-specific parts of UBSan runtime. Requires a C++ ABI library.
+    set(UBSAN_CXX_SOURCES ${UBSAN_CXXABI_SOURCES})
+  else()
+    # Dummy target if we don't have C++ ABI library.
+    file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/cxx_dummy.cc "")
+    set(UBSAN_CXX_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/cxx_dummy.cc)
+  endif()
+
   add_compiler_rt_object_libraries(RTUbsan_cxx
     ARCHS ${UBSAN_COMMON_SUPPORTED_ARCH}
     SOURCES ${UBSAN_CXX_SOURCES} CFLAGS ${UBSAN_CXXFLAGS})


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23638.68901.patch
Type: text/x-patch
Size: 1414 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160822/ed02a0f0/attachment.bin>


More information about the llvm-commits mailing list