2012-12-25 20:39:56 +08:00
|
|
|
include_directories(..)
|
2012-12-11 20:27:27 +08:00
|
|
|
|
2012-12-25 20:39:56 +08:00
|
|
|
# Runtime library sources and build flags.
|
|
|
|
set(MSAN_RTL_SOURCES
|
2012-12-11 20:27:27 +08:00
|
|
|
msan.cc
|
|
|
|
msan_allocator.cc
|
2014-05-21 17:02:13 +08:00
|
|
|
msan_chained_origin_depot.cc
|
2012-12-11 20:27:27 +08:00
|
|
|
msan_interceptors.cc
|
|
|
|
msan_linux.cc
|
2012-12-26 17:32:05 +08:00
|
|
|
msan_report.cc
|
2014-04-04 17:47:41 +08:00
|
|
|
msan_thread.cc
|
2015-01-22 00:42:30 +08:00
|
|
|
msan_poisoning.cc
|
2012-12-11 20:27:27 +08:00
|
|
|
)
|
2014-02-18 15:52:40 +08:00
|
|
|
|
2015-04-28 06:08:09 +08:00
|
|
|
set(MSAN_RTL_CXX_SOURCES
|
|
|
|
msan_new_delete.cc)
|
|
|
|
|
|
|
|
|
2014-02-18 16:07:09 +08:00
|
|
|
set(MSAN_RTL_CFLAGS ${SANITIZER_COMMON_CFLAGS})
|
Adding Msan support to FreeBSD
Summary:
Enabling the memory sanitizer support for FreeBSD, most of unit tests are compatible.
- Adding fstat and stressor_r interceptors.
- Updating the struct link_map access since most likely the struct Obj_Entry had been updated since.
- Disabling few unit tests until further work is needed (or we can assume it can work in real world code).
Patch by: David CARLIER
Reviewers: vitalybuka, krytarowski
Reviewed By: vitalybuka
Subscribers: eugenis, dim, srhines, emaste, kubamracek, mgorny, fedor.sergeev, hintonda, llvm-commits, #sanitizers
Differential Revision: https://reviews.llvm.org/D43080
llvm-svn: 326644
2018-03-03 19:43:11 +08:00
|
|
|
append_list_if(COMPILER_RT_HAS_FTLS_MODEL_INITIAL_EXEC -ftls-model=initial-exec MSAN_RTL_CFLAGS)
|
2016-03-05 18:01:04 +08:00
|
|
|
append_rtti_flag(OFF MSAN_RTL_CFLAGS)
|
Adding Msan support to FreeBSD
Summary:
Enabling the memory sanitizer support for FreeBSD, most of unit tests are compatible.
- Adding fstat and stressor_r interceptors.
- Updating the struct link_map access since most likely the struct Obj_Entry had been updated since.
- Disabling few unit tests until further work is needed (or we can assume it can work in real world code).
Patch by: David CARLIER
Reviewers: vitalybuka, krytarowski
Reviewed By: vitalybuka
Subscribers: eugenis, dim, srhines, emaste, kubamracek, mgorny, fedor.sergeev, hintonda, llvm-commits, #sanitizers
Differential Revision: https://reviews.llvm.org/D43080
llvm-svn: 326644
2018-03-03 19:43:11 +08:00
|
|
|
if(NOT CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
|
|
|
append_list_if(COMPILER_RT_HAS_FPIE_FLAG -fPIE MSAN_RTL_CFLAGS)
|
|
|
|
endif()
|
2014-02-18 16:07:09 +08:00
|
|
|
# Prevent clang from generating libc calls.
|
2014-10-16 06:47:54 +08:00
|
|
|
append_list_if(COMPILER_RT_HAS_FFREESTANDING_FLAG -ffreestanding MSAN_RTL_CFLAGS)
|
2012-12-11 20:27:27 +08:00
|
|
|
|
2014-05-10 06:11:03 +08:00
|
|
|
set(MSAN_RUNTIME_LIBRARIES)
|
|
|
|
|
2012-12-25 20:39:56 +08:00
|
|
|
# Static runtime library.
|
2016-08-27 04:52:22 +08:00
|
|
|
add_compiler_rt_component(msan)
|
2016-07-12 05:51:56 +08:00
|
|
|
|
2014-11-20 05:42:33 +08:00
|
|
|
foreach(arch ${MSAN_SUPPORTED_ARCH})
|
2015-08-26 03:53:09 +08:00
|
|
|
add_compiler_rt_runtime(clang_rt.msan
|
|
|
|
STATIC
|
|
|
|
ARCHS ${arch}
|
2013-01-20 22:14:13 +08:00
|
|
|
SOURCES ${MSAN_RTL_SOURCES}
|
|
|
|
$<TARGET_OBJECTS:RTInterception.${arch}>
|
|
|
|
$<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
|
2013-05-18 00:17:19 +08:00
|
|
|
$<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
|
2015-04-28 08:56:48 +08:00
|
|
|
$<TARGET_OBJECTS:RTUbsan.${arch}>
|
2015-08-26 03:53:09 +08:00
|
|
|
CFLAGS ${MSAN_RTL_CFLAGS}
|
|
|
|
PARENT_TARGET msan)
|
|
|
|
add_compiler_rt_runtime(clang_rt.msan_cxx
|
|
|
|
STATIC
|
|
|
|
ARCHS ${arch}
|
2015-04-28 06:08:09 +08:00
|
|
|
SOURCES ${MSAN_RTL_CXX_SOURCES}
|
2015-04-28 08:56:48 +08:00
|
|
|
$<TARGET_OBJECTS:RTUbsan_cxx.${arch}>
|
2015-08-26 03:53:09 +08:00
|
|
|
CFLAGS ${MSAN_RTL_CFLAGS}
|
|
|
|
PARENT_TARGET msan)
|
2015-04-28 06:08:09 +08:00
|
|
|
list(APPEND MSAN_RUNTIME_LIBRARIES clang_rt.msan-${arch}
|
|
|
|
clang_rt.msan_cxx-${arch})
|
2013-08-28 16:07:04 +08:00
|
|
|
if(UNIX)
|
2015-08-28 04:07:54 +08:00
|
|
|
add_sanitizer_rt_symbols(clang_rt.msan
|
|
|
|
ARCHS ${arch}
|
2015-08-27 07:12:25 +08:00
|
|
|
EXTRA msan.syms.extra)
|
2015-08-28 04:07:54 +08:00
|
|
|
add_sanitizer_rt_symbols(clang_rt.msan_cxx
|
|
|
|
ARCHS ${arch}
|
2015-08-27 07:12:25 +08:00
|
|
|
EXTRA msan.syms.extra)
|
2015-04-28 06:08:09 +08:00
|
|
|
add_dependencies(msan clang_rt.msan-${arch}-symbols
|
|
|
|
clang_rt.msan_cxx-${arch}-symbols)
|
2013-08-28 16:07:04 +08:00
|
|
|
endif()
|
2014-11-20 05:42:33 +08:00
|
|
|
endforeach()
|
2012-12-25 20:39:56 +08:00
|
|
|
|
2016-02-24 05:50:39 +08:00
|
|
|
add_compiler_rt_resource_file(msan_blacklist msan_blacklist.txt msan)
|
2013-06-10 17:09:40 +08:00
|
|
|
|
2014-02-19 19:18:47 +08:00
|
|
|
if(COMPILER_RT_INCLUDE_TESTS)
|
2012-12-25 20:39:56 +08:00
|
|
|
add_subdirectory(tests)
|
|
|
|
endif()
|