diff options
author | Kostya Kortchinsky <kostyak@google.com> | 2018-06-21 21:48:04 +0000 |
---|---|---|
committer | Kostya Kortchinsky <kostyak@google.com> | 2018-06-21 21:48:04 +0000 |
commit | 307c2eb94fcf943d30346c5a24a44cbdf00ac024 (patch) | |
tree | 393104d49bb93453a84dd3ef1e0c50edcbda5e99 | |
parent | dc3f88ad981061a7b4b2872927fceca9ac336453 (diff) | |
download | bcm5719-llvm-307c2eb94fcf943d30346c5a24a44cbdf00ac024.tar.gz bcm5719-llvm-307c2eb94fcf943d30346c5a24a44cbdf00ac024.zip |
[scudo] Add a minimal runtime for -fsanitize-minimal-runtime compatibility
Summary:
This patch follows D48373.
The point is to be able to use Scudo with `-fsanitize-minimal-runtime`. For that
we need a runtime that doesn't embed the UBSan one. This results in binaries
that can be compiled with `-fsanitize=scudo,integer -fsanitize-minimal-runtime`.
Reviewers: eugenis
Reviewed By: eugenis
Subscribers: mgorny, delcypher, llvm-commits, #sanitizers
Differential Revision: https://reviews.llvm.org/D48377
llvm-svn: 335296
-rw-r--r-- | compiler-rt/lib/scudo/CMakeLists.txt | 42 |
1 files changed, 34 insertions, 8 deletions
diff --git a/compiler-rt/lib/scudo/CMakeLists.txt b/compiler-rt/lib/scudo/CMakeLists.txt index 32472af5c8a..ce0e5cce1ac 100644 --- a/compiler-rt/lib/scudo/CMakeLists.txt +++ b/compiler-rt/lib/scudo/CMakeLists.txt @@ -7,30 +7,33 @@ set(SCUDO_CFLAGS ${SANITIZER_COMMON_CFLAGS}) list(APPEND SCUDO_CFLAGS -fbuiltin) append_rtti_flag(OFF SCUDO_CFLAGS) -set(SCUDO_DYNAMIC_LIBS ${SANITIZER_COMMON_LINK_LIBS}) -append_list_if(COMPILER_RT_HAS_LIBDL dl SCUDO_DYNAMIC_LIBS) -append_list_if(COMPILER_RT_HAS_LIBRT rt SCUDO_DYNAMIC_LIBS) -append_list_if(COMPILER_RT_HAS_LIBPTHREAD pthread SCUDO_DYNAMIC_LIBS) -append_list_if(COMPILER_RT_HAS_LIBLOG log SCUDO_DYNAMIC_LIBS) +set(SCUDO_MINIMAL_DYNAMIC_LIBS ${SANITIZER_COMMON_LINK_LIBS}) +append_list_if(COMPILER_RT_HAS_LIBDL dl SCUDO_MINIMAL_DYNAMIC_LIBS) +append_list_if(COMPILER_RT_HAS_LIBRT rt SCUDO_MINIMAL_DYNAMIC_LIBS) +append_list_if(COMPILER_RT_HAS_LIBPTHREAD pthread SCUDO_MINIMAL_DYNAMIC_LIBS) +append_list_if(COMPILER_RT_HAS_LIBLOG log SCUDO_MINIMAL_DYNAMIC_LIBS) set(SCUDO_DYNAMIC_LINK_FLAGS ${SANITIZER_COMMON_LINK_FLAGS}) # Use gc-sections by default to avoid unused code being pulled in. list(APPEND SCUDO_DYNAMIC_LINK_FLAGS -Wl,--gc-sections) -set(SCUDO_OBJECT_LIBS +# The minimal Scudo runtime does not inlude the UBSan runtime. +set(SCUDO_MINIMAL_OBJECT_LIBS RTSanitizerCommonNoTermination RTSanitizerCommonLibc RTInterception) +set(SCUDO_OBJECT_LIBS ${SCUDO_MINIMAL_OBJECT_LIBS}) +set(SCUDO_DYNAMIC_LIBS ${SCUDO_MINIMAL_DYNAMIC_LIBS}) if (FUCHSIA) list(APPEND SCUDO_CFLAGS -nostdinc++) list(APPEND SCUDO_DYNAMIC_LINK_FLAGS -nostdlib++) else() + list(APPEND SCUDO_DYNAMIC_LIBS ${SANITIZER_CXX_ABI_LIBRARY}) list(APPEND SCUDO_OBJECT_LIBS RTSanitizerCommonCoverage RTSanitizerCommonSymbolizer RTUbsan) - list(APPEND SCUDO_DYNAMIC_LIBS ${SANITIZER_CXX_ABI_LIBRARY}) endif() set(SCUDO_SOURCES @@ -59,6 +62,20 @@ if (COMPILER_RT_HAS_MCRC_FLAG) endif() if(COMPILER_RT_HAS_SCUDO) + add_compiler_rt_runtime(clang_rt.scudo_minimal + STATIC + ARCHS ${SCUDO_SUPPORTED_ARCH} + SOURCES ${SCUDO_SOURCES} + OBJECT_LIBS ${SCUDO_MINIMAL_OBJECT_LIBS} + CFLAGS ${SCUDO_CFLAGS} + PARENT_TARGET scudo) + add_compiler_rt_runtime(clang_rt.scudo_cxx_minimal + STATIC + ARCHS ${SCUDO_SUPPORTED_ARCH} + SOURCES ${SCUDO_CXX_SOURCES} + CFLAGS ${SCUDO_CFLAGS} + PARENT_TARGET scudo) + add_compiler_rt_runtime(clang_rt.scudo STATIC ARCHS ${SCUDO_SUPPORTED_ARCH} @@ -66,7 +83,6 @@ if(COMPILER_RT_HAS_SCUDO) OBJECT_LIBS ${SCUDO_OBJECT_LIBS} CFLAGS ${SCUDO_CFLAGS} PARENT_TARGET scudo) - add_compiler_rt_runtime(clang_rt.scudo_cxx STATIC ARCHS ${SCUDO_SUPPORTED_ARCH} @@ -75,6 +91,16 @@ if(COMPILER_RT_HAS_SCUDO) CFLAGS ${SCUDO_CFLAGS} PARENT_TARGET scudo) + add_compiler_rt_runtime(clang_rt.scudo_minimal + SHARED + ARCHS ${SCUDO_SUPPORTED_ARCH} + SOURCES ${SCUDO_SOURCES} ${SCUDO_CXX_SOURCES} + OBJECT_LIBS ${SCUDO_MINIMAL_OBJECT_LIBS} + CFLAGS ${SCUDO_CFLAGS} + LINK_FLAGS ${SCUDO_DYNAMIC_LINK_FLAGS} + LINK_LIBS ${SCUDO_MINIMAL_DYNAMIC_LIBS} + PARENT_TARGET scudo) + add_compiler_rt_runtime(clang_rt.scudo SHARED ARCHS ${SCUDO_SUPPORTED_ARCH} |