diff options
author | Kostya Kortchinsky <kostyak@google.com> | 2018-03-27 14:40:39 +0000 |
---|---|---|
committer | Kostya Kortchinsky <kostyak@google.com> | 2018-03-27 14:40:39 +0000 |
commit | eeee252d505b9311c2e99ed290f67ba4f29a69bb (patch) | |
tree | 98f280be4baae17b3fdfd49db4c04528c66aac5a | |
parent | ae0a7735b9b0bc63845debefe0f2669b0eb7c1be (diff) | |
download | bcm5719-llvm-eeee252d505b9311c2e99ed290f67ba4f29a69bb.tar.gz bcm5719-llvm-eeee252d505b9311c2e99ed290f67ba4f29a69bb.zip |
[scudo] Fuchsia minimal shared runtime
Summary:
Fuchsia requires its Scudo shared runtime to not be C++ dependant. Since they
don't use UBSan in conjunction with Scudo, we can just remove the runtime,
and add the extra `nostdinc++` and `nostdlib++` flags. No need for Coverage
either. This allows to keep things going while working on additional splits
of sanitizer_commong and a more minimal runtime.
Reviewers: phosek, flowerhack, alekseyshl
Reviewed By: phosek, alekseyshl
Subscribers: mgorny, delcypher, #sanitizers, llvm-commits
Differential Revision: https://reviews.llvm.org/D44791
llvm-svn: 328625
-rw-r--r-- | compiler-rt/lib/scudo/CMakeLists.txt | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/compiler-rt/lib/scudo/CMakeLists.txt b/compiler-rt/lib/scudo/CMakeLists.txt index 97a26fa4230..319bd3bb96f 100644 --- a/compiler-rt/lib/scudo/CMakeLists.txt +++ b/compiler-rt/lib/scudo/CMakeLists.txt @@ -4,15 +4,34 @@ include_directories(..) set(SCUDO_CFLAGS ${SANITIZER_COMMON_CFLAGS}) # SANITIZER_COMMON_CFLAGS include -fno-builtin, but we actually want builtins! -list(APPEND SCUDO_CFLAGS -fbuiltin) +list(APPEND SCUDO_CFLAGS -fbuiltin -ffunction-sections -fdata-sections) append_rtti_flag(OFF SCUDO_CFLAGS) -set(SCUDO_DYNAMIC_LINK_FLAGS ${SANITIZER_COMMON_LINK_FLAGS}) +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_DYNAMIC_LINK_FLAGS ${SANITIZER_COMMON_LINK_FLAGS}) # Use gc-sections by default to avoid unused code being pulled in. -list(APPEND SCUDO_CFLAGS -ffunction-sections -fdata-sections) list(APPEND SCUDO_DYNAMIC_LINK_FLAGS -Wl,--gc-sections) +set(SCUDO_OBJECT_LIBS + RTSanitizerCommonNoTermination + RTSanitizerCommonLibc + RTInterception) + +if (FUCHSIA) + list(APPEND SCUDO_CFLAGS -nostdinc++) + list(APPEND SCUDO_DYNAMIC_LINK_FLAGS -nostdlib++) + # TODO(kostyak): remove when stacktraces are split off of RTSanitizerCommon + list(APPEND SCUDO_DYNAMIC_LIBS unwind_shared) +else() + list(APPEND SCUDO_OBJECT_LIBS RTSanitizerCommonCoverage RTUbsan) + list(APPEND SCUDO_DYNAMIC_LIBS ${SANITIZER_CXX_ABI_LIBRARY}) +endif() + set(SCUDO_SOURCES scudo_allocator.cpp scudo_crc32.cpp @@ -38,22 +57,11 @@ if (COMPILER_RT_HAS_MCRC_FLAG) endif() if(COMPILER_RT_HAS_SCUDO) - set(SCUDO_DYNAMIC_LIBS ${SANITIZER_CXX_ABI_LIBRARY} - ${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) - add_compiler_rt_runtime(clang_rt.scudo STATIC ARCHS ${SCUDO_SUPPORTED_ARCH} SOURCES ${SCUDO_SOURCES} - OBJECT_LIBS RTSanitizerCommonNoTermination - RTSanitizerCommonLibc - RTSanitizerCommonCoverage - RTInterception - RTUbsan + OBJECT_LIBS ${SCUDO_OBJECT_LIBS} CFLAGS ${SCUDO_CFLAGS} PARENT_TARGET scudo) @@ -69,12 +77,7 @@ if(COMPILER_RT_HAS_SCUDO) SHARED ARCHS ${SCUDO_SUPPORTED_ARCH} SOURCES ${SCUDO_SOURCES} ${SCUDO_CXX_SOURCES} - OBJECT_LIBS RTSanitizerCommonNoTermination - RTSanitizerCommonLibc - RTSanitizerCommonCoverage - RTInterception - RTUbsan - RTUbsan_cxx + OBJECT_LIBS ${SCUDO_OBJECT_LIBS} CFLAGS ${SCUDO_CFLAGS} LINK_FLAGS ${SCUDO_DYNAMIC_LINK_FLAGS} LINK_LIBS ${SCUDO_DYNAMIC_LIBS} |