diff options
| author | Alexey Samsonov <vonosmas@gmail.com> | 2015-03-23 20:05:53 +0000 |
|---|---|---|
| committer | Alexey Samsonov <vonosmas@gmail.com> | 2015-03-23 20:05:53 +0000 |
| commit | 6a7ee6f460892dd7993979f02b7a604f2998759b (patch) | |
| tree | 9d048ea23d0117b27c73568dc15e0d45e1c1bc5f | |
| parent | 3ae177cdb340c5bfb86d5a08b6a51a103564e490 (diff) | |
| download | bcm5719-llvm-6a7ee6f460892dd7993979f02b7a604f2998759b.tar.gz bcm5719-llvm-6a7ee6f460892dd7993979f02b7a604f2998759b.zip | |
[UBSan] Introduce "ubsan_standalone" library (compiler-rt part).
Get rid of "libclang_rt.san" library that used to contain
sanitizer_common pieces required by UBSan if it's used in a standalone
mode. Instead, build two variants of UBSan runtime: "ubsan" and
"ubsan_standalone" (same for "ubsan_cxx" and "ubsan_standalone_cxx").
Later "ubsan" and "ubsan_cxx" libraries will go away, as they will
embedded it into corresponding ASan runtimes.
llvm-svn: 233011
| -rw-r--r-- | compiler-rt/lib/sanitizer_common/CMakeLists.txt | 6 | ||||
| -rw-r--r-- | compiler-rt/lib/ubsan/CMakeLists.txt | 34 |
2 files changed, 27 insertions, 13 deletions
diff --git a/compiler-rt/lib/sanitizer_common/CMakeLists.txt b/compiler-rt/lib/sanitizer_common/CMakeLists.txt index e9082d97ef1..5b32b6ad9c7 100644 --- a/compiler-rt/lib/sanitizer_common/CMakeLists.txt +++ b/compiler-rt/lib/sanitizer_common/CMakeLists.txt @@ -142,12 +142,6 @@ else() DEFS ${SANITIZER_COMMON_DEFINITIONS}) list(APPEND SANITIZER_RUNTIME_LIBRARIES RTSanitizerCommon.${arch} RTSanitizerCommonLibc.${arch}) - add_compiler_rt_runtime(clang_rt.san-${arch} ${arch} STATIC - SOURCES $<TARGET_OBJECTS:RTSanitizerCommon.${arch}> - $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}> - CFLAGS ${SANITIZER_CFLAGS} - DEFS ${SANITIZER_COMMON_DEFINITIONS}) - add_dependencies(sanitizer_common clang_rt.san-${arch}) endforeach() endif() diff --git a/compiler-rt/lib/ubsan/CMakeLists.txt b/compiler-rt/lib/ubsan/CMakeLists.txt index 66832729625..07b163d65c5 100644 --- a/compiler-rt/lib/ubsan/CMakeLists.txt +++ b/compiler-rt/lib/ubsan/CMakeLists.txt @@ -32,24 +32,44 @@ if(APPLE) else() # Build separate libraries for each target. foreach(arch ${UBSAN_SUPPORTED_ARCH}) - # Main UBSan runtime. + 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_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 ${UBSAN_SOURCES} + SOURCES $<TARGET_OBJECTS:RTUbsan.${arch}> 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} + 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() |

