summaryrefslogtreecommitdiff
path: root/lib/ubsan
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2013-03-20 23:49:17 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2013-03-20 23:49:17 +0000
commit3e587a4f631c1b7338d4f2a29df74b704b8bb1ca (patch)
treec0b0cf95f41a5813e7c53ad12ce714172dfda953 /lib/ubsan
parentedcb288a81c4e6abd6537342295750d9d1223349 (diff)
Split ubsan runtime into three pieces (compiler-rt part):
* libclang_rt-san-* is sanitizer_common, and is linked in only if no other sanitizer runtime is present. * libclang_rt-ubsan-* is the piece of the runtime which doesn't depend on a C++ ABI library, and is always linked in. * libclang_rt-ubsan_cxx-* is the piece of the runtime which depends on a C++ ABI library, and is only linked in when linking a C++ binary. The Darwin ubsan runtime is unchanged. For more details, see Clang change r177605. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@177606 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ubsan')
-rw-r--r--lib/ubsan/CMakeLists.txt18
-rw-r--r--lib/ubsan/Makefile.mk5
2 files changed, 18 insertions, 5 deletions
diff --git a/lib/ubsan/CMakeLists.txt b/lib/ubsan/CMakeLists.txt
index b549153e5..3dd8613be 100644
--- a/lib/ubsan/CMakeLists.txt
+++ b/lib/ubsan/CMakeLists.txt
@@ -3,9 +3,12 @@
set(UBSAN_SOURCES
ubsan_diag.cc
ubsan_handlers.cc
+ ubsan_value.cc
+ )
+
+set(UBSAN_CXX_SOURCES
ubsan_handlers_cxx.cc
ubsan_type_hash.cc
- ubsan_value.cc
)
include_directories(..)
@@ -21,18 +24,25 @@ if(APPLE)
# Build universal binary on APPLE.
add_compiler_rt_osx_static_runtime(clang_rt.ubsan_osx
ARCH ${UBSAN_SUPPORTED_ARCH}
- SOURCES ${UBSAN_SOURCES}
+ SOURCES ${UBSAN_SOURCES} ${UBSAN_CXX_SOURCES}
$<TARGET_OBJECTS:RTSanitizerCommon.osx>
CFLAGS ${UBSAN_CFLAGS})
list(APPEND UBSAN_RUNTIME_LIBRARIES clang_rt.ubsan_osx)
else()
# Build separate libraries for each target.
foreach(arch ${UBSAN_SUPPORTED_ARCH})
+ # Main UBSan runtime.
add_compiler_rt_static_runtime(clang_rt.ubsan-${arch} ${arch}
SOURCES ${UBSAN_SOURCES}
- $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
CFLAGS ${UBSAN_CFLAGS})
- list(APPEND UBSAN_RUNTIME_LIBRARIES clang_rt.ubsan-${arch})
+ # C++-specific parts of UBSan runtime. Requires a C++ ABI library.
+ add_compiler_rt_static_runtime(clang_rt.ubsan_cxx-${arch} ${arch}
+ SOURCES ${UBSAN_CXX_SOURCES}
+ CFLAGS ${UBSAN_CFLAGS})
+ list(APPEND UBSAN_RUNTIME_LIBRARIES
+ clang_rt.san-${arch}
+ clang_rt.ubsan-${arch}
+ clang_rt.ubsan_cxx-${arch})
endforeach()
endif()
diff --git a/lib/ubsan/Makefile.mk b/lib/ubsan/Makefile.mk
index 5702e0e75..d5561f41b 100644
--- a/lib/ubsan/Makefile.mk
+++ b/lib/ubsan/Makefile.mk
@@ -11,6 +11,8 @@ ModuleName := ubsan
SubDirs :=
Sources := $(foreach file,$(wildcard $(Dir)/*.cc),$(notdir $(file)))
+CXXSources := ubsan_type_hash.cc ubsan_handlers_cxx.cc
+CSources := $(filter-out $(CXXSources),$(Sources))
ObjNames := $(Sources:%.cc=%.o)
Implementation := Generic
@@ -20,4 +22,5 @@ Dependencies := $(wildcard $(Dir)/*.h)
Dependencies += $(wildcard $(Dir)/../sanitizer_common/*.h)
# Define a convenience variable for all the ubsan functions.
-UbsanFunctions := $(Sources:%.cc=%)
+UbsanFunctions := $(CSources:%.cc=%)
+UbsanCXXFunctions := $(CXXSources:%.cc=%)