Update aosp/master compiler-rt for rebase to r233350
Change-Id: I5f20256ce73ec7b5956f742b4062f850bf11b667
diff --git a/lib/ubsan/CMakeLists.txt b/lib/ubsan/CMakeLists.txt
index 6683272..a8b3f61 100644
--- a/lib/ubsan/CMakeLists.txt
+++ b/lib/ubsan/CMakeLists.txt
@@ -22,34 +22,61 @@
add_custom_target(ubsan)
if(APPLE)
- # Build universal binary on APPLE.
- add_compiler_rt_osx_static_runtime(clang_rt.ubsan_osx
- ARCH ${UBSAN_SUPPORTED_ARCH}
- SOURCES ${UBSAN_SOURCES} ${UBSAN_CXX_SOURCES}
- $<TARGET_OBJECTS:RTSanitizerCommon.osx>
- CFLAGS ${UBSAN_CXXFLAGS})
- add_dependencies(ubsan clang_rt.ubsan_osx)
+ foreach(os ${SANITIZER_COMMON_SUPPORTED_DARWIN_OS})
+ add_compiler_rt_darwin_object_library(RTUbsan ${os}
+ ARCH ${UBSAN_SUPPORTED_ARCH}
+ SOURCES ${UBSAN_SOURCES} ${UBSAN_CXX_SOURCES}
+ CFLAGS ${UBSAN_CXXFLAGS})
+
+ add_compiler_rt_darwin_dynamic_runtime(clang_rt.ubsan_${os}_dynamic ${os}
+ ARCH ${UBSAN_SUPPORTED_ARCH}
+ SOURCES $<TARGET_OBJECTS:RTUbsan.${os}>
+ $<TARGET_OBJECTS:RTSanitizerCommon.${os}>
+ LINKFLAGS -lc++abi)
+
+ add_dependencies(ubsan clang_rt.ubsan_${os}_dynamic)
+ endforeach()
else()
# Build separate libraries for each target.
foreach(arch ${UBSAN_SUPPORTED_ARCH})
- # Main UBSan runtime.
- add_compiler_rt_runtime(clang_rt.ubsan-${arch} ${arch} STATIC
- SOURCES ${UBSAN_SOURCES}
- CFLAGS ${UBSAN_CFLAGS})
+ add_compiler_rt_object_library(RTUbsan ${arch}
+ SOURCES ${UBSAN_SOURCES} CFLAGS ${UBSAN_CFLAGS})
# C++-specific parts of UBSan runtime. Requires a C++ ABI library.
- add_compiler_rt_runtime(clang_rt.ubsan_cxx-${arch} ${arch} STATIC
- SOURCES ${UBSAN_CXX_SOURCES}
+ add_compiler_rt_object_library(RTUbsan_cxx ${arch}
+ SOURCES ${UBSAN_CXX_SOURCES} CFLAGS ${UBSAN_CXXFLAGS})
+
+ # Standalone UBSan runtimes.
+ add_compiler_rt_runtime(clang_rt.ubsan_standalone-${arch} ${arch} STATIC
+ SOURCES $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
+ $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
+ $<TARGET_OBJECTS:RTUbsan.${arch}>
+ CFLAGS ${UBSAN_CFLAGS})
+ add_compiler_rt_runtime(clang_rt.ubsan_standalone_cxx-${arch} ${arch} STATIC
+ SOURCES $<TARGET_OBJECTS:RTUbsan_cxx.${arch}>
CFLAGS ${UBSAN_CXXFLAGS})
+ # UBSan runtimes used when another sanitizer is available.
+ add_compiler_rt_runtime(clang_rt.ubsan-${arch} ${arch} STATIC
+ SOURCES $<TARGET_OBJECTS:RTUbsan.${arch}>
+ CFLAGS ${UBSAN_CFLAGS})
+ add_compiler_rt_runtime(clang_rt.ubsan_cxx-${arch} ${arch} STATIC
+ SOURCES $<TARGET_OBJECTS:RTUbsan_cxx.${arch}>
+ CFLAGS ${UBSAN_CXXFLAGS})
+
add_dependencies(ubsan
- clang_rt.san-${arch}
clang_rt.ubsan-${arch}
- clang_rt.ubsan_cxx-${arch})
+ clang_rt.ubsan_cxx-${arch}
+ clang_rt.ubsan_standalone-${arch}
+ clang_rt.ubsan_standalone_cxx-${arch})
if (UNIX AND NOT ${arch} MATCHES "i386|i686")
add_sanitizer_rt_symbols(clang_rt.ubsan-${arch} ubsan.syms.extra)
add_sanitizer_rt_symbols(clang_rt.ubsan_cxx-${arch} ubsan.syms.extra)
+ add_sanitizer_rt_symbols(clang_rt.ubsan_standalone-${arch} ubsan.syms.extra)
+ add_sanitizer_rt_symbols(clang_rt.ubsan_standalone_cxx-${arch} ubsan.syms.extra)
add_dependencies(ubsan
clang_rt.ubsan-${arch}-symbols
- clang_rt.ubsan_cxx-${arch}-symbols)
+ clang_rt.ubsan_cxx-${arch}-symbols
+ clang_rt.ubsan_standalone-${arch}-symbols
+ clang_rt.ubsan_standalone_cxx-${arch}-symbols)
endif()
endforeach()
endif()