From 654de9cb6f8f66a9e5a0d110c54e89121b562934 Mon Sep 17 00:00:00 2001 From: Alex Shlyapnikov Date: Fri, 22 Dec 2017 18:04:20 +0000 Subject: [Sanitizers, CMake] Basic sanitizer Solaris support (PR 33274) Summary: This patch, on top of https://reviews.llvm.org/D40898, contains the build system changes necessary to enable the Solaris/x86 sanitizer port. The only issue of note is the libclang_rt.sancov_{begin, end} libraries: clang relies on the linker automatically defining __start_SECNAME and __stop_SECNAME labels for sections whose names are valid C identifiers. This is a GNU ld extension not present in the ELF gABI, also implemented by gold and lld, but not by Solaris ld. To work around this, I automatically link the sancov_{begin,end} libraries into every executable for now. There seems to be now way to build individual startup objects like crtbegin.o/crtend.o, so I've followed the lead of libclang_rt.asan-preinit which also contains just a single object. Reviewers: kcc, alekseyshl Reviewed By: alekseyshl Subscribers: srhines, kubamracek, mgorny, fedor.sergeev, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D40899 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@321373 91177308-0d34-0410-b5e6-96231b3b80d8 --- cmake/config-ix.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'cmake') diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake index ada471953..9e0c47748 100644 --- a/cmake/config-ix.cmake +++ b/cmake/config-ix.cmake @@ -486,7 +486,7 @@ set(COMPILER_RT_SANITIZERS_TO_BUILD all CACHE STRING list_replace(COMPILER_RT_SANITIZERS_TO_BUILD all "${ALL_SANITIZERS}") if (SANITIZER_COMMON_SUPPORTED_ARCH AND NOT LLVM_USE_SANITIZER AND - (OS_NAME MATCHES "Android|Darwin|Linux|FreeBSD|NetBSD|Fuchsia" OR + (OS_NAME MATCHES "Android|Darwin|Linux|FreeBSD|NetBSD|Fuchsia|SunOS" OR (OS_NAME MATCHES "Windows" AND (NOT MINGW AND NOT CYGWIN)))) set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE) else() @@ -505,7 +505,7 @@ else() set(COMPILER_RT_HAS_ASAN FALSE) endif() -if (OS_NAME MATCHES "Linux|FreeBSD|Windows|NetBSD") +if (OS_NAME MATCHES "Linux|FreeBSD|Windows|NetBSD|SunOS") set(COMPILER_RT_ASAN_HAS_STATIC_RUNTIME TRUE) else() set(COMPILER_RT_ASAN_HAS_STATIC_RUNTIME FALSE) @@ -556,7 +556,7 @@ else() endif() if (COMPILER_RT_HAS_SANITIZER_COMMON AND UBSAN_SUPPORTED_ARCH AND - OS_NAME MATCHES "Darwin|Linux|FreeBSD|NetBSD|Windows|Android|Fuchsia") + OS_NAME MATCHES "Darwin|Linux|FreeBSD|NetBSD|Windows|Android|Fuchsia|SunOS") set(COMPILER_RT_HAS_UBSAN TRUE) else() set(COMPILER_RT_HAS_UBSAN FALSE) -- cgit v1.2.3