2015-02-26 07:07:32 +08:00
|
|
|
include(CMakePushCheckState)
|
2014-02-18 15:26:58 +08:00
|
|
|
include(CheckCXXCompilerFlag)
|
2014-03-04 21:28:21 +08:00
|
|
|
include(CheckLibraryExists)
|
2014-02-27 14:52:41 +08:00
|
|
|
include(CheckSymbolExists)
|
2015-02-10 09:42:44 +08:00
|
|
|
include(TestBigEndian)
|
2014-02-18 15:26:58 +08:00
|
|
|
|
2015-05-06 04:13:39 +08:00
|
|
|
function(check_linker_flag flag out_var)
|
|
|
|
cmake_push_check_state()
|
|
|
|
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${flag}")
|
|
|
|
check_cxx_compiler_flag("" ${out_var})
|
|
|
|
cmake_pop_check_state()
|
|
|
|
endfunction()
|
|
|
|
|
2014-02-18 15:26:58 +08:00
|
|
|
# CodeGen options.
|
|
|
|
check_cxx_compiler_flag(-fPIC COMPILER_RT_HAS_FPIC_FLAG)
|
2014-02-18 16:07:09 +08:00
|
|
|
check_cxx_compiler_flag(-fPIE COMPILER_RT_HAS_FPIE_FLAG)
|
2014-02-18 15:26:58 +08:00
|
|
|
check_cxx_compiler_flag(-fno-builtin COMPILER_RT_HAS_FNO_BUILTIN_FLAG)
|
|
|
|
check_cxx_compiler_flag(-fno-exceptions COMPILER_RT_HAS_FNO_EXCEPTIONS_FLAG)
|
|
|
|
check_cxx_compiler_flag(-fomit-frame-pointer COMPILER_RT_HAS_FOMIT_FRAME_POINTER_FLAG)
|
|
|
|
check_cxx_compiler_flag(-funwind-tables COMPILER_RT_HAS_FUNWIND_TABLES_FLAG)
|
|
|
|
check_cxx_compiler_flag(-fno-stack-protector COMPILER_RT_HAS_FNO_STACK_PROTECTOR_FLAG)
|
2015-06-16 05:08:47 +08:00
|
|
|
check_cxx_compiler_flag(-fno-sanitize=safe-stack COMPILER_RT_HAS_FNO_SANITIZE_SAFE_STACK_FLAG)
|
2014-02-18 15:26:58 +08:00
|
|
|
check_cxx_compiler_flag(-fvisibility=hidden COMPILER_RT_HAS_FVISIBILITY_HIDDEN_FLAG)
|
2016-03-05 18:01:04 +08:00
|
|
|
check_cxx_compiler_flag(-frtti COMPILER_RT_HAS_FRTTI_FLAG)
|
2014-02-18 15:52:40 +08:00
|
|
|
check_cxx_compiler_flag(-fno-rtti COMPILER_RT_HAS_FNO_RTTI_FLAG)
|
2014-02-18 16:07:09 +08:00
|
|
|
check_cxx_compiler_flag(-ffreestanding COMPILER_RT_HAS_FFREESTANDING_FLAG)
|
2014-02-18 15:26:58 +08:00
|
|
|
check_cxx_compiler_flag("-Werror -fno-function-sections" COMPILER_RT_HAS_FNO_FUNCTION_SECTIONS_FLAG)
|
2014-03-18 20:49:22 +08:00
|
|
|
check_cxx_compiler_flag(-std=c++11 COMPILER_RT_HAS_STD_CXX11_FLAG)
|
2014-04-01 21:16:30 +08:00
|
|
|
check_cxx_compiler_flag(-ftls-model=initial-exec COMPILER_RT_HAS_FTLS_MODEL_INITIAL_EXEC)
|
2015-01-01 02:20:52 +08:00
|
|
|
check_cxx_compiler_flag(-fno-lto COMPILER_RT_HAS_FNO_LTO_FLAG)
|
2015-12-10 06:26:38 +08:00
|
|
|
check_cxx_compiler_flag("-Werror -msse3" COMPILER_RT_HAS_MSSE3_FLAG)
|
2015-12-08 07:21:36 +08:00
|
|
|
check_cxx_compiler_flag(--sysroot=. COMPILER_RT_HAS_SYSROOT_FLAG)
|
2014-02-18 15:26:58 +08:00
|
|
|
|
2015-12-01 01:42:30 +08:00
|
|
|
if(NOT WIN32 AND NOT CYGWIN)
|
|
|
|
# MinGW warns if -fvisibility-inlines-hidden is used.
|
|
|
|
check_cxx_compiler_flag("-fvisibility-inlines-hidden" COMPILER_RT_HAS_FVISIBILITY_INLINES_HIDDEN_FLAG)
|
|
|
|
endif()
|
|
|
|
|
2014-02-18 15:52:40 +08:00
|
|
|
check_cxx_compiler_flag(/GR COMPILER_RT_HAS_GR_FLAG)
|
2014-02-18 15:26:58 +08:00
|
|
|
check_cxx_compiler_flag(/GS COMPILER_RT_HAS_GS_FLAG)
|
|
|
|
check_cxx_compiler_flag(/MT COMPILER_RT_HAS_MT_FLAG)
|
|
|
|
check_cxx_compiler_flag(/Oy COMPILER_RT_HAS_Oy_FLAG)
|
|
|
|
|
|
|
|
# Debug info flags.
|
|
|
|
check_cxx_compiler_flag(-gline-tables-only COMPILER_RT_HAS_GLINE_TABLES_ONLY_FLAG)
|
|
|
|
check_cxx_compiler_flag(-g COMPILER_RT_HAS_G_FLAG)
|
|
|
|
check_cxx_compiler_flag(/Zi COMPILER_RT_HAS_Zi_FLAG)
|
2015-02-03 04:37:25 +08:00
|
|
|
|
2014-02-18 15:26:58 +08:00
|
|
|
# Warnings.
|
2014-03-06 20:25:02 +08:00
|
|
|
check_cxx_compiler_flag(-Wall COMPILER_RT_HAS_WALL_FLAG)
|
2014-02-24 19:32:49 +08:00
|
|
|
check_cxx_compiler_flag(-Werror COMPILER_RT_HAS_WERROR_FLAG)
|
2014-02-18 15:26:58 +08:00
|
|
|
check_cxx_compiler_flag("-Werror -Wframe-larger-than=512" COMPILER_RT_HAS_WFRAME_LARGER_THAN_FLAG)
|
|
|
|
check_cxx_compiler_flag("-Werror -Wglobal-constructors" COMPILER_RT_HAS_WGLOBAL_CONSTRUCTORS_FLAG)
|
2014-11-14 05:19:53 +08:00
|
|
|
check_cxx_compiler_flag("-Werror -Wc99-extensions" COMPILER_RT_HAS_WC99_EXTENSIONS_FLAG)
|
|
|
|
check_cxx_compiler_flag("-Werror -Wgnu" COMPILER_RT_HAS_WGNU_FLAG)
|
|
|
|
check_cxx_compiler_flag("-Werror -Wnon-virtual-dtor" COMPILER_RT_HAS_WNON_VIRTUAL_DTOR_FLAG)
|
|
|
|
check_cxx_compiler_flag("-Werror -Wvariadic-macros" COMPILER_RT_HAS_WVARIADIC_MACROS_FLAG)
|
2014-02-18 15:26:58 +08:00
|
|
|
|
2014-03-13 19:31:10 +08:00
|
|
|
check_cxx_compiler_flag(/W3 COMPILER_RT_HAS_W3_FLAG)
|
2014-02-24 19:32:49 +08:00
|
|
|
check_cxx_compiler_flag(/WX COMPILER_RT_HAS_WX_FLAG)
|
2014-10-24 04:39:58 +08:00
|
|
|
check_cxx_compiler_flag(/wd4146 COMPILER_RT_HAS_WD4146_FLAG)
|
|
|
|
check_cxx_compiler_flag(/wd4291 COMPILER_RT_HAS_WD4291_FLAG)
|
2014-08-26 20:33:00 +08:00
|
|
|
check_cxx_compiler_flag(/wd4391 COMPILER_RT_HAS_WD4391_FLAG)
|
2014-02-18 15:26:58 +08:00
|
|
|
check_cxx_compiler_flag(/wd4722 COMPILER_RT_HAS_WD4722_FLAG)
|
2014-10-24 04:39:58 +08:00
|
|
|
check_cxx_compiler_flag(/wd4800 COMPILER_RT_HAS_WD4800_FLAG)
|
2014-02-27 14:52:41 +08:00
|
|
|
|
|
|
|
# Symbols.
|
|
|
|
check_symbol_exists(__func__ "" COMPILER_RT_HAS_FUNC_SYMBOL)
|
2014-03-04 21:28:21 +08:00
|
|
|
|
|
|
|
# Libraries.
|
2015-12-10 08:47:50 +08:00
|
|
|
check_library_exists(c fopen "" COMPILER_RT_HAS_LIBC)
|
2014-03-04 21:28:21 +08:00
|
|
|
check_library_exists(dl dlopen "" COMPILER_RT_HAS_LIBDL)
|
2015-05-30 06:31:28 +08:00
|
|
|
check_library_exists(rt shm_open "" COMPILER_RT_HAS_LIBRT)
|
2014-08-22 20:26:34 +08:00
|
|
|
check_library_exists(m pow "" COMPILER_RT_HAS_LIBM)
|
2014-03-04 21:28:21 +08:00
|
|
|
check_library_exists(pthread pthread_create "" COMPILER_RT_HAS_LIBPTHREAD)
|
2014-08-22 20:26:34 +08:00
|
|
|
check_library_exists(stdc++ __cxa_throw "" COMPILER_RT_HAS_LIBSTDCXX)
|
2014-08-09 06:01:20 +08:00
|
|
|
|
2015-05-06 04:13:39 +08:00
|
|
|
# Linker flags.
|
|
|
|
if(ANDROID)
|
|
|
|
check_linker_flag("-Wl,-z,global" COMPILER_RT_HAS_Z_GLOBAL)
|
2015-07-25 03:00:16 +08:00
|
|
|
check_library_exists(log __android_log_write "" COMPILER_RT_HAS_LIBLOG)
|
2015-05-06 04:13:39 +08:00
|
|
|
endif()
|
|
|
|
|
2014-08-09 06:01:20 +08:00
|
|
|
# Architectures.
|
|
|
|
|
|
|
|
# List of all architectures we can target.
|
|
|
|
set(COMPILER_RT_SUPPORTED_ARCH)
|
|
|
|
|
|
|
|
# Try to compile a very simple source file to ensure we can target the given
|
|
|
|
# platform. We use the results of these tests to build only the various target
|
|
|
|
# runtime libraries supported by our current compilers cross-compiling
|
|
|
|
# abilities.
|
|
|
|
set(SIMPLE_SOURCE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/simple.cc)
|
|
|
|
file(WRITE ${SIMPLE_SOURCE} "#include <stdlib.h>\n#include <limits>\nint main() {}\n")
|
|
|
|
|
2014-09-29 21:18:55 +08:00
|
|
|
# Add $arch as supported with no additional flags.
|
|
|
|
macro(add_default_target_arch arch)
|
|
|
|
set(TARGET_${arch}_CFLAGS "")
|
|
|
|
set(CAN_TARGET_${arch} 1)
|
|
|
|
list(APPEND COMPILER_RT_SUPPORTED_ARCH ${arch})
|
|
|
|
endmacro()
|
|
|
|
|
2015-01-30 05:32:34 +08:00
|
|
|
# Detect whether the current target platform is 32-bit or 64-bit, and setup
|
|
|
|
# the correct commandline flags needed to attempt to target 32-bit and 64-bit.
|
|
|
|
if (NOT CMAKE_SIZEOF_VOID_P EQUAL 4 AND
|
|
|
|
NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
|
|
|
|
message(FATAL_ERROR "Please use architecture with 4 or 8 byte pointers.")
|
|
|
|
endif()
|
|
|
|
|
[CMake] Support platform building builtins without a full toolchain
Summary:
This patch adds support for building lib/builtins without a fully functioning toolchain. It allows you to bootstrap a cross-compiler, which previously couldn't be done with CMake.
This patch contains the following specific changes:
* Split builtin-specific code out of config-ix.cmake into builtin-config-ix.cmake
* Split some common CMake functionality needed by both builtins and sanitizers into base-config-ix.cmake
* Made lib/builtins/CMakeLists.txt able to be a top-level CMake configuration
I have tested this on Darwin targeting embedded Darwin, and on FreeBSD x86_64 targeting FreeBSD AArch64.
This patch depends on http://reviews.llvm.org/D19692, and is the last part of http://reviews.llvm.org/D16653.
Reviewers: samsonov, iains, jroelofs
Subscribers: compnerd, aemerson, tberghammer, danalbert, srhines, emaste, llvm-commits
Differential Revision: http://reviews.llvm.org/D19742
llvm-svn: 268977
2016-05-10 05:45:52 +08:00
|
|
|
test_targets()
|
2014-08-09 06:01:20 +08:00
|
|
|
|
2015-05-19 17:07:37 +08:00
|
|
|
# Returns a list of architecture specific target cflags in @out_var list.
|
2015-01-30 05:32:34 +08:00
|
|
|
function(get_target_flags_for_arch arch out_var)
|
|
|
|
list(FIND COMPILER_RT_SUPPORTED_ARCH ${arch} ARCH_INDEX)
|
|
|
|
if(ARCH_INDEX EQUAL -1)
|
|
|
|
message(FATAL_ERROR "Unsupported architecture: ${arch}")
|
|
|
|
else()
|
2015-08-21 01:32:06 +08:00
|
|
|
if (NOT APPLE)
|
|
|
|
set(${out_var} ${TARGET_${arch}_CFLAGS} PARENT_SCOPE)
|
|
|
|
else()
|
|
|
|
# This is only called in constructing cflags for tests executing on the
|
|
|
|
# host. This will need to all be cleaned up to support building tests
|
|
|
|
# for cross-targeted hardware (i.e. iOS).
|
|
|
|
set(${out_var} -arch ${arch} PARENT_SCOPE)
|
|
|
|
endif()
|
2015-01-30 05:32:34 +08:00
|
|
|
endif()
|
|
|
|
endfunction()
|
|
|
|
|
[CMake] Add experimental support for building compiler-rt for iOS
Summary:
This is a reunification of three separate reviews D11073, D11082, D11083.
Having them separate was not constructive even though the patches were smaller because it led to fragmented conversations, and this is really all about one change.
This patch incorporates feedback from samsonov, and refactors the hacky darwin code out of the root CMakeLists.txt and int config-ix.cmake.
Reviewers: zaks.anna, bogner, kubabrecka, chandlerc, samsonov
Subscribers: jevinskie, filcab, llvm-commits
Differential Revision: http://reviews.llvm.org/D11820
llvm-svn: 244948
2015-08-14 04:38:16 +08:00
|
|
|
set(ARM64 aarch64)
|
2015-09-26 11:26:01 +08:00
|
|
|
set(ARM32 arm armhf)
|
2015-09-25 00:45:58 +08:00
|
|
|
set(X86 i386 i686)
|
[CMake] Add experimental support for building compiler-rt for iOS
Summary:
This is a reunification of three separate reviews D11073, D11082, D11083.
Having them separate was not constructive even though the patches were smaller because it led to fragmented conversations, and this is really all about one change.
This patch incorporates feedback from samsonov, and refactors the hacky darwin code out of the root CMakeLists.txt and int config-ix.cmake.
Reviewers: zaks.anna, bogner, kubabrecka, chandlerc, samsonov
Subscribers: jevinskie, filcab, llvm-commits
Differential Revision: http://reviews.llvm.org/D11820
llvm-svn: 244948
2015-08-14 04:38:16 +08:00
|
|
|
set(X86_64 x86_64)
|
2015-09-25 00:45:58 +08:00
|
|
|
set(MIPS32 mips mipsel)
|
|
|
|
set(MIPS64 mips64 mips64el)
|
|
|
|
set(PPC64 powerpc64 powerpc64le)
|
2016-04-16 06:25:04 +08:00
|
|
|
set(S390X s390x)
|
2016-01-14 00:56:15 +08:00
|
|
|
set(WASM32 wasm32)
|
|
|
|
set(WASM64 wasm64)
|
2015-09-25 00:45:58 +08:00
|
|
|
|
[CMake] Add experimental support for building compiler-rt for iOS
Summary:
This is a reunification of three separate reviews D11073, D11082, D11083.
Having them separate was not constructive even though the patches were smaller because it led to fragmented conversations, and this is really all about one change.
This patch incorporates feedback from samsonov, and refactors the hacky darwin code out of the root CMakeLists.txt and int config-ix.cmake.
Reviewers: zaks.anna, bogner, kubabrecka, chandlerc, samsonov
Subscribers: jevinskie, filcab, llvm-commits
Differential Revision: http://reviews.llvm.org/D11820
llvm-svn: 244948
2015-08-14 04:38:16 +08:00
|
|
|
if(APPLE)
|
|
|
|
set(ARM64 arm64)
|
2016-02-02 10:01:17 +08:00
|
|
|
set(ARM32 armv7 armv7s armv7k)
|
[CMake] Add experimental support for building compiler-rt for iOS
Summary:
This is a reunification of three separate reviews D11073, D11082, D11083.
Having them separate was not constructive even though the patches were smaller because it led to fragmented conversations, and this is really all about one change.
This patch incorporates feedback from samsonov, and refactors the hacky darwin code out of the root CMakeLists.txt and int config-ix.cmake.
Reviewers: zaks.anna, bogner, kubabrecka, chandlerc, samsonov
Subscribers: jevinskie, filcab, llvm-commits
Differential Revision: http://reviews.llvm.org/D11820
llvm-svn: 244948
2015-08-14 04:38:16 +08:00
|
|
|
set(X86_64 x86_64 x86_64h)
|
|
|
|
endif()
|
|
|
|
|
2015-09-25 00:45:58 +08:00
|
|
|
set(ALL_SANITIZER_COMMON_SUPPORTED_ARCH ${X86} ${X86_64} ${PPC64}
|
2016-04-16 06:25:04 +08:00
|
|
|
${ARM32} ${ARM64} ${MIPS32} ${MIPS64} ${S390X})
|
2015-09-25 00:45:58 +08:00
|
|
|
set(ALL_ASAN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64}
|
|
|
|
${MIPS32} ${MIPS64} ${PPC64})
|
|
|
|
set(ALL_DFSAN_SUPPORTED_ARCH ${X86_64} ${MIPS64} ${ARM64})
|
2015-10-21 21:08:06 +08:00
|
|
|
set(ALL_LSAN_SUPPORTED_ARCH ${X86_64} ${MIPS64} ${ARM64})
|
2016-05-14 10:17:38 +08:00
|
|
|
set(ALL_MSAN_SUPPORTED_ARCH ${X86_64} ${MIPS64} ${ARM64})
|
2015-09-25 00:45:58 +08:00
|
|
|
set(ALL_PROFILE_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${PPC64}
|
|
|
|
${MIPS32} ${MIPS64})
|
2015-12-09 05:54:39 +08:00
|
|
|
set(ALL_TSAN_SUPPORTED_ARCH ${X86_64} ${MIPS64} ${ARM64} ${PPC64})
|
2015-09-25 00:45:58 +08:00
|
|
|
set(ALL_UBSAN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64}
|
2016-04-16 06:25:04 +08:00
|
|
|
${MIPS32} ${MIPS64} ${PPC64} ${S390X})
|
2016-03-04 14:15:59 +08:00
|
|
|
set(ALL_SAFESTACK_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM64} ${MIPS32} ${MIPS64})
|
2016-04-27 13:49:42 +08:00
|
|
|
set(ALL_CFI_SUPPORTED_ARCH ${X86} ${X86_64} ${MIPS64})
|
2016-04-22 05:32:25 +08:00
|
|
|
set(ALL_ESAN_SUPPORTED_ARCH ${X86_64})
|
[sanitizer] Initial implementation of a Hardened Allocator
Summary:
This is an initial implementation of a Hardened Allocator based on Sanitizer Common's CombinedAllocator.
It aims at mitigating heap based vulnerabilities by adding several features to the base allocator, while staying relatively fast.
The following were implemented:
- additional consistency checks on the allocation function parameters and on the heap chunks;
- use of checksum protected chunk header, to detect corruption;
- randomness to the allocator base;
- delayed freelist (quarantine), to mitigate use after free and overall determinism.
Additional mitigations are in the works.
Reviewers: eugenis, aizatsky, pcc, krasin, vitalybuka, glider, dvyukov, kcc
Subscribers: kubabrecka, filcab, llvm-commits
Differential Revision: http://reviews.llvm.org/D20084
llvm-svn: 271968
2016-06-07 09:20:26 +08:00
|
|
|
set(ALL_SCUDO_SUPPORTED_ARCH ${X86_64})
|
[CMake] Add experimental support for building compiler-rt for iOS
Summary:
This is a reunification of three separate reviews D11073, D11082, D11083.
Having them separate was not constructive even though the patches were smaller because it led to fragmented conversations, and this is really all about one change.
This patch incorporates feedback from samsonov, and refactors the hacky darwin code out of the root CMakeLists.txt and int config-ix.cmake.
Reviewers: zaks.anna, bogner, kubabrecka, chandlerc, samsonov
Subscribers: jevinskie, filcab, llvm-commits
Differential Revision: http://reviews.llvm.org/D11820
llvm-svn: 244948
2015-08-14 04:38:16 +08:00
|
|
|
|
|
|
|
if(APPLE)
|
|
|
|
include(CompilerRTDarwinUtils)
|
|
|
|
|
2015-09-23 23:18:17 +08:00
|
|
|
find_darwin_sdk_dir(DARWIN_osx_SYSROOT macosx)
|
|
|
|
find_darwin_sdk_dir(DARWIN_iossim_SYSROOT iphonesimulator)
|
|
|
|
find_darwin_sdk_dir(DARWIN_ios_SYSROOT iphoneos)
|
2016-01-13 07:51:03 +08:00
|
|
|
find_darwin_sdk_dir(DARWIN_watchossim_SYSROOT watchsimulator)
|
|
|
|
find_darwin_sdk_dir(DARWIN_watchos_SYSROOT watchos)
|
|
|
|
find_darwin_sdk_dir(DARWIN_tvossim_SYSROOT appletvsimulator)
|
|
|
|
find_darwin_sdk_dir(DARWIN_tvos_SYSROOT appletvos)
|
|
|
|
|
|
|
|
if(COMPILER_RT_ENABLE_IOS)
|
|
|
|
list(APPEND DARWIN_EMBEDDED_PLATFORMS ios)
|
|
|
|
set(DARWIN_ios_MIN_VER_FLAG -miphoneos-version-min)
|
|
|
|
set(DARWIN_ios_SANITIZER_MIN_VER_FLAG
|
|
|
|
${DARWIN_ios_MIN_VER_FLAG}=7.0)
|
|
|
|
endif()
|
|
|
|
if(COMPILER_RT_ENABLE_WATCHOS)
|
|
|
|
list(APPEND DARWIN_EMBEDDED_PLATFORMS watchos)
|
|
|
|
set(DARWIN_watchos_MIN_VER_FLAG -mwatchos-version-min)
|
|
|
|
set(DARWIN_watchos_SANITIZER_MIN_VER_FLAG
|
|
|
|
${DARWIN_watchos_MIN_VER_FLAG}=2.0)
|
|
|
|
endif()
|
|
|
|
if(COMPILER_RT_ENABLE_TVOS)
|
|
|
|
list(APPEND DARWIN_EMBEDDED_PLATFORMS tvos)
|
|
|
|
set(DARWIN_tvos_MIN_VER_FLAG -mtvos-version-min)
|
|
|
|
set(DARWIN_tvos_SANITIZER_MIN_VER_FLAG
|
|
|
|
${DARWIN_tvos_MIN_VER_FLAG}=9.0)
|
|
|
|
endif()
|
[CMake] Add experimental support for building compiler-rt for iOS
Summary:
This is a reunification of three separate reviews D11073, D11082, D11083.
Having them separate was not constructive even though the patches were smaller because it led to fragmented conversations, and this is really all about one change.
This patch incorporates feedback from samsonov, and refactors the hacky darwin code out of the root CMakeLists.txt and int config-ix.cmake.
Reviewers: zaks.anna, bogner, kubabrecka, chandlerc, samsonov
Subscribers: jevinskie, filcab, llvm-commits
Differential Revision: http://reviews.llvm.org/D11820
llvm-svn: 244948
2015-08-14 04:38:16 +08:00
|
|
|
|
|
|
|
# Note: In order to target x86_64h on OS X the minimum deployment target must
|
|
|
|
# be 10.8 or higher.
|
|
|
|
set(SANITIZER_COMMON_SUPPORTED_OS osx)
|
2015-10-01 05:23:22 +08:00
|
|
|
set(PROFILE_SUPPORTED_OS osx)
|
2015-11-03 22:13:59 +08:00
|
|
|
set(TSAN_SUPPORTED_OS osx)
|
[CMake] Add experimental support for building compiler-rt for iOS
Summary:
This is a reunification of three separate reviews D11073, D11082, D11083.
Having them separate was not constructive even though the patches were smaller because it led to fragmented conversations, and this is really all about one change.
This patch incorporates feedback from samsonov, and refactors the hacky darwin code out of the root CMakeLists.txt and int config-ix.cmake.
Reviewers: zaks.anna, bogner, kubabrecka, chandlerc, samsonov
Subscribers: jevinskie, filcab, llvm-commits
Differential Revision: http://reviews.llvm.org/D11820
llvm-svn: 244948
2015-08-14 04:38:16 +08:00
|
|
|
if(NOT SANITIZER_MIN_OSX_VERSION)
|
|
|
|
string(REGEX MATCH "-mmacosx-version-min=([.0-9]+)"
|
|
|
|
MACOSX_VERSION_MIN_FLAG "${CMAKE_CXX_FLAGS}")
|
|
|
|
if(MACOSX_VERSION_MIN_FLAG)
|
|
|
|
set(SANITIZER_MIN_OSX_VERSION "${CMAKE_MATCH_1}")
|
|
|
|
elseif(CMAKE_OSX_DEPLOYMENT_TARGET)
|
|
|
|
set(SANITIZER_MIN_OSX_VERSION ${CMAKE_OSX_DEPLOYMENT_TARGET})
|
|
|
|
else()
|
|
|
|
set(SANITIZER_MIN_OSX_VERSION 10.9)
|
|
|
|
endif()
|
|
|
|
if(SANITIZER_MIN_OSX_VERSION VERSION_LESS "10.7")
|
|
|
|
message(FATAL_ERROR "Too old OS X version: ${SANITIZER_MIN_OSX_VERSION}")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# We're setting the flag manually for each target OS
|
|
|
|
set(CMAKE_OSX_DEPLOYMENT_TARGET "")
|
|
|
|
|
|
|
|
set(DARWIN_COMMON_CFLAGS -stdlib=libc++)
|
|
|
|
set(DARWIN_COMMON_LINKFLAGS
|
|
|
|
-stdlib=libc++
|
|
|
|
-lc++
|
|
|
|
-lc++abi)
|
|
|
|
|
2016-01-07 07:15:04 +08:00
|
|
|
check_linker_flag("-fapplication-extension" COMPILER_RT_HAS_APP_EXTENSION)
|
|
|
|
if(COMPILER_RT_HAS_APP_EXTENSION)
|
|
|
|
list(APPEND DARWIN_COMMON_LINKFLAGS "-fapplication-extension")
|
|
|
|
endif()
|
|
|
|
|
[CMake] Add experimental support for building compiler-rt for iOS
Summary:
This is a reunification of three separate reviews D11073, D11082, D11083.
Having them separate was not constructive even though the patches were smaller because it led to fragmented conversations, and this is really all about one change.
This patch incorporates feedback from samsonov, and refactors the hacky darwin code out of the root CMakeLists.txt and int config-ix.cmake.
Reviewers: zaks.anna, bogner, kubabrecka, chandlerc, samsonov
Subscribers: jevinskie, filcab, llvm-commits
Differential Revision: http://reviews.llvm.org/D11820
llvm-svn: 244948
2015-08-14 04:38:16 +08:00
|
|
|
set(DARWIN_osx_CFLAGS
|
|
|
|
${DARWIN_COMMON_CFLAGS}
|
|
|
|
-mmacosx-version-min=${SANITIZER_MIN_OSX_VERSION})
|
|
|
|
set(DARWIN_osx_LINKFLAGS
|
|
|
|
${DARWIN_COMMON_LINKFLAGS}
|
|
|
|
-mmacosx-version-min=${SANITIZER_MIN_OSX_VERSION})
|
|
|
|
|
2015-09-23 23:18:17 +08:00
|
|
|
if(DARWIN_osx_SYSROOT)
|
|
|
|
list(APPEND DARWIN_osx_CFLAGS -isysroot ${DARWIN_osx_SYSROOT})
|
|
|
|
list(APPEND DARWIN_osx_LINKFLAGS -isysroot ${DARWIN_osx_SYSROOT})
|
[CMake] Add experimental support for building compiler-rt for iOS
Summary:
This is a reunification of three separate reviews D11073, D11082, D11083.
Having them separate was not constructive even though the patches were smaller because it led to fragmented conversations, and this is really all about one change.
This patch incorporates feedback from samsonov, and refactors the hacky darwin code out of the root CMakeLists.txt and int config-ix.cmake.
Reviewers: zaks.anna, bogner, kubabrecka, chandlerc, samsonov
Subscribers: jevinskie, filcab, llvm-commits
Differential Revision: http://reviews.llvm.org/D11820
llvm-svn: 244948
2015-08-14 04:38:16 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# Figure out which arches to use for each OS
|
|
|
|
darwin_get_toolchain_supported_archs(toolchain_arches)
|
|
|
|
message(STATUS "Toolchain supported arches: ${toolchain_arches}")
|
|
|
|
|
|
|
|
if(NOT MACOSX_VERSION_MIN_FLAG)
|
|
|
|
darwin_test_archs(osx
|
|
|
|
DARWIN_osx_ARCHS
|
|
|
|
${toolchain_arches})
|
|
|
|
message(STATUS "OSX supported arches: ${DARWIN_osx_ARCHS}")
|
|
|
|
foreach(arch ${DARWIN_osx_ARCHS})
|
|
|
|
list(APPEND COMPILER_RT_SUPPORTED_ARCH ${arch})
|
|
|
|
set(CAN_TARGET_${arch} 1)
|
|
|
|
endforeach()
|
|
|
|
|
2016-01-13 07:51:03 +08:00
|
|
|
foreach(platform ${DARWIN_EMBEDDED_PLATFORMS})
|
|
|
|
if(DARWIN_${platform}sim_SYSROOT)
|
|
|
|
set(DARWIN_${platform}sim_CFLAGS
|
|
|
|
${DARWIN_COMMON_CFLAGS}
|
|
|
|
${DARWIN_${platform}_SANITIZER_MIN_VER_FLAG}
|
2016-05-26 19:18:22 +08:00
|
|
|
-isysroot ${DARWIN_${platform}sim_SYSROOT})
|
2016-01-13 07:51:03 +08:00
|
|
|
set(DARWIN_${platform}sim_LINKFLAGS
|
|
|
|
${DARWIN_COMMON_LINKFLAGS}
|
|
|
|
${DARWIN_${platform}_SANITIZER_MIN_VER_FLAG}
|
|
|
|
-isysroot ${DARWIN_${platform}sim_SYSROOT})
|
|
|
|
|
|
|
|
set(DARWIN_${platform}sim_SKIP_CC_KEXT On)
|
|
|
|
darwin_test_archs(${platform}sim
|
|
|
|
DARWIN_${platform}sim_ARCHS
|
|
|
|
${toolchain_arches})
|
|
|
|
message(STATUS "${platform} Simulator supported arches: ${DARWIN_${platform}sim_ARCHS}")
|
2016-04-27 01:53:25 +08:00
|
|
|
if(DARWIN_${platform}_ARCHS)
|
2016-01-13 07:51:03 +08:00
|
|
|
list(APPEND SANITIZER_COMMON_SUPPORTED_OS ${platform}sim)
|
|
|
|
list(APPEND PROFILE_SUPPORTED_OS ${platform}sim)
|
2016-04-27 01:53:25 +08:00
|
|
|
if(DARWIN_${platform}_SYSROOT_INTERNAL)
|
|
|
|
list(APPEND TSAN_SUPPORTED_OS ${platform}sim)
|
|
|
|
endif()
|
2016-01-13 07:51:03 +08:00
|
|
|
endif()
|
|
|
|
foreach(arch ${DARWIN_${platform}sim_ARCHS})
|
|
|
|
list(APPEND COMPILER_RT_SUPPORTED_ARCH ${arch})
|
|
|
|
set(CAN_TARGET_${arch} 1)
|
|
|
|
endforeach()
|
2015-10-02 02:58:59 +08:00
|
|
|
endif()
|
[CMake] Add experimental support for building compiler-rt for iOS
Summary:
This is a reunification of three separate reviews D11073, D11082, D11083.
Having them separate was not constructive even though the patches were smaller because it led to fragmented conversations, and this is really all about one change.
This patch incorporates feedback from samsonov, and refactors the hacky darwin code out of the root CMakeLists.txt and int config-ix.cmake.
Reviewers: zaks.anna, bogner, kubabrecka, chandlerc, samsonov
Subscribers: jevinskie, filcab, llvm-commits
Differential Revision: http://reviews.llvm.org/D11820
llvm-svn: 244948
2015-08-14 04:38:16 +08:00
|
|
|
|
2016-01-13 07:51:03 +08:00
|
|
|
if(DARWIN_${platform}_SYSROOT)
|
|
|
|
set(DARWIN_${platform}_CFLAGS
|
|
|
|
${DARWIN_COMMON_CFLAGS}
|
|
|
|
${DARWIN_${platform}_SANITIZER_MIN_VER_FLAG}
|
|
|
|
-isysroot ${DARWIN_${platform}_SYSROOT})
|
|
|
|
set(DARWIN_${platform}_LINKFLAGS
|
|
|
|
${DARWIN_COMMON_LINKFLAGS}
|
|
|
|
${DARWIN_${platform}_SANITIZER_MIN_VER_FLAG}
|
|
|
|
-isysroot ${DARWIN_${platform}_SYSROOT})
|
|
|
|
|
|
|
|
darwin_test_archs(${platform}
|
|
|
|
DARWIN_${platform}_ARCHS
|
|
|
|
${toolchain_arches})
|
|
|
|
message(STATUS "${platform} supported arches: ${DARWIN_${platform}_ARCHS}")
|
|
|
|
if(DARWIN_${platform}_ARCHS)
|
|
|
|
list(APPEND SANITIZER_COMMON_SUPPORTED_OS ${platform})
|
|
|
|
list(APPEND PROFILE_SUPPORTED_OS ${platform})
|
|
|
|
endif()
|
|
|
|
foreach(arch ${DARWIN_${platform}_ARCHS})
|
|
|
|
list(APPEND COMPILER_RT_SUPPORTED_ARCH ${arch})
|
|
|
|
set(CAN_TARGET_${arch} 1)
|
|
|
|
endforeach()
|
2015-10-02 02:58:59 +08:00
|
|
|
endif()
|
2016-01-13 07:51:03 +08:00
|
|
|
endforeach()
|
[CMake] Add experimental support for building compiler-rt for iOS
Summary:
This is a reunification of three separate reviews D11073, D11082, D11083.
Having them separate was not constructive even though the patches were smaller because it led to fragmented conversations, and this is really all about one change.
This patch incorporates feedback from samsonov, and refactors the hacky darwin code out of the root CMakeLists.txt and int config-ix.cmake.
Reviewers: zaks.anna, bogner, kubabrecka, chandlerc, samsonov
Subscribers: jevinskie, filcab, llvm-commits
Differential Revision: http://reviews.llvm.org/D11820
llvm-svn: 244948
2015-08-14 04:38:16 +08:00
|
|
|
endif()
|
|
|
|
|
2016-01-27 17:28:01 +08:00
|
|
|
# for list_intersect
|
[CMake] Add experimental support for building compiler-rt for iOS
Summary:
This is a reunification of three separate reviews D11073, D11082, D11083.
Having them separate was not constructive even though the patches were smaller because it led to fragmented conversations, and this is really all about one change.
This patch incorporates feedback from samsonov, and refactors the hacky darwin code out of the root CMakeLists.txt and int config-ix.cmake.
Reviewers: zaks.anna, bogner, kubabrecka, chandlerc, samsonov
Subscribers: jevinskie, filcab, llvm-commits
Differential Revision: http://reviews.llvm.org/D11820
llvm-svn: 244948
2015-08-14 04:38:16 +08:00
|
|
|
include(CompilerRTUtils)
|
|
|
|
|
2015-09-01 05:24:50 +08:00
|
|
|
|
2016-01-27 17:28:01 +08:00
|
|
|
list_intersect(SANITIZER_COMMON_SUPPORTED_ARCH
|
[CMake] Add experimental support for building compiler-rt for iOS
Summary:
This is a reunification of three separate reviews D11073, D11082, D11083.
Having them separate was not constructive even though the patches were smaller because it led to fragmented conversations, and this is really all about one change.
This patch incorporates feedback from samsonov, and refactors the hacky darwin code out of the root CMakeLists.txt and int config-ix.cmake.
Reviewers: zaks.anna, bogner, kubabrecka, chandlerc, samsonov
Subscribers: jevinskie, filcab, llvm-commits
Differential Revision: http://reviews.llvm.org/D11820
llvm-svn: 244948
2015-08-14 04:38:16 +08:00
|
|
|
ALL_SANITIZER_COMMON_SUPPORTED_ARCH
|
|
|
|
COMPILER_RT_SUPPORTED_ARCH
|
|
|
|
)
|
|
|
|
set(LSAN_COMMON_SUPPORTED_ARCH ${SANITIZER_COMMON_SUPPORTED_ARCH})
|
|
|
|
set(UBSAN_COMMON_SUPPORTED_ARCH ${SANITIZER_COMMON_SUPPORTED_ARCH})
|
2016-01-27 17:28:01 +08:00
|
|
|
list_intersect(ASAN_SUPPORTED_ARCH
|
[CMake] Add experimental support for building compiler-rt for iOS
Summary:
This is a reunification of three separate reviews D11073, D11082, D11083.
Having them separate was not constructive even though the patches were smaller because it led to fragmented conversations, and this is really all about one change.
This patch incorporates feedback from samsonov, and refactors the hacky darwin code out of the root CMakeLists.txt and int config-ix.cmake.
Reviewers: zaks.anna, bogner, kubabrecka, chandlerc, samsonov
Subscribers: jevinskie, filcab, llvm-commits
Differential Revision: http://reviews.llvm.org/D11820
llvm-svn: 244948
2015-08-14 04:38:16 +08:00
|
|
|
ALL_ASAN_SUPPORTED_ARCH
|
|
|
|
SANITIZER_COMMON_SUPPORTED_ARCH)
|
2016-01-27 17:28:01 +08:00
|
|
|
list_intersect(DFSAN_SUPPORTED_ARCH
|
[CMake] Add experimental support for building compiler-rt for iOS
Summary:
This is a reunification of three separate reviews D11073, D11082, D11083.
Having them separate was not constructive even though the patches were smaller because it led to fragmented conversations, and this is really all about one change.
This patch incorporates feedback from samsonov, and refactors the hacky darwin code out of the root CMakeLists.txt and int config-ix.cmake.
Reviewers: zaks.anna, bogner, kubabrecka, chandlerc, samsonov
Subscribers: jevinskie, filcab, llvm-commits
Differential Revision: http://reviews.llvm.org/D11820
llvm-svn: 244948
2015-08-14 04:38:16 +08:00
|
|
|
ALL_DFSAN_SUPPORTED_ARCH
|
|
|
|
SANITIZER_COMMON_SUPPORTED_ARCH)
|
2016-01-27 17:28:01 +08:00
|
|
|
list_intersect(LSAN_SUPPORTED_ARCH
|
[CMake] Add experimental support for building compiler-rt for iOS
Summary:
This is a reunification of three separate reviews D11073, D11082, D11083.
Having them separate was not constructive even though the patches were smaller because it led to fragmented conversations, and this is really all about one change.
This patch incorporates feedback from samsonov, and refactors the hacky darwin code out of the root CMakeLists.txt and int config-ix.cmake.
Reviewers: zaks.anna, bogner, kubabrecka, chandlerc, samsonov
Subscribers: jevinskie, filcab, llvm-commits
Differential Revision: http://reviews.llvm.org/D11820
llvm-svn: 244948
2015-08-14 04:38:16 +08:00
|
|
|
ALL_LSAN_SUPPORTED_ARCH
|
|
|
|
SANITIZER_COMMON_SUPPORTED_ARCH)
|
2016-01-27 17:28:01 +08:00
|
|
|
list_intersect(MSAN_SUPPORTED_ARCH
|
[CMake] Add experimental support for building compiler-rt for iOS
Summary:
This is a reunification of three separate reviews D11073, D11082, D11083.
Having them separate was not constructive even though the patches were smaller because it led to fragmented conversations, and this is really all about one change.
This patch incorporates feedback from samsonov, and refactors the hacky darwin code out of the root CMakeLists.txt and int config-ix.cmake.
Reviewers: zaks.anna, bogner, kubabrecka, chandlerc, samsonov
Subscribers: jevinskie, filcab, llvm-commits
Differential Revision: http://reviews.llvm.org/D11820
llvm-svn: 244948
2015-08-14 04:38:16 +08:00
|
|
|
ALL_MSAN_SUPPORTED_ARCH
|
|
|
|
SANITIZER_COMMON_SUPPORTED_ARCH)
|
2016-01-27 17:28:01 +08:00
|
|
|
list_intersect(PROFILE_SUPPORTED_ARCH
|
[CMake] Add experimental support for building compiler-rt for iOS
Summary:
This is a reunification of three separate reviews D11073, D11082, D11083.
Having them separate was not constructive even though the patches were smaller because it led to fragmented conversations, and this is really all about one change.
This patch incorporates feedback from samsonov, and refactors the hacky darwin code out of the root CMakeLists.txt and int config-ix.cmake.
Reviewers: zaks.anna, bogner, kubabrecka, chandlerc, samsonov
Subscribers: jevinskie, filcab, llvm-commits
Differential Revision: http://reviews.llvm.org/D11820
llvm-svn: 244948
2015-08-14 04:38:16 +08:00
|
|
|
ALL_PROFILE_SUPPORTED_ARCH
|
2015-10-01 05:23:22 +08:00
|
|
|
SANITIZER_COMMON_SUPPORTED_ARCH)
|
2016-01-27 17:28:01 +08:00
|
|
|
list_intersect(TSAN_SUPPORTED_ARCH
|
[CMake] Add experimental support for building compiler-rt for iOS
Summary:
This is a reunification of three separate reviews D11073, D11082, D11083.
Having them separate was not constructive even though the patches were smaller because it led to fragmented conversations, and this is really all about one change.
This patch incorporates feedback from samsonov, and refactors the hacky darwin code out of the root CMakeLists.txt and int config-ix.cmake.
Reviewers: zaks.anna, bogner, kubabrecka, chandlerc, samsonov
Subscribers: jevinskie, filcab, llvm-commits
Differential Revision: http://reviews.llvm.org/D11820
llvm-svn: 244948
2015-08-14 04:38:16 +08:00
|
|
|
ALL_TSAN_SUPPORTED_ARCH
|
|
|
|
SANITIZER_COMMON_SUPPORTED_ARCH)
|
2016-01-27 17:28:01 +08:00
|
|
|
list_intersect(UBSAN_SUPPORTED_ARCH
|
[CMake] Add experimental support for building compiler-rt for iOS
Summary:
This is a reunification of three separate reviews D11073, D11082, D11083.
Having them separate was not constructive even though the patches were smaller because it led to fragmented conversations, and this is really all about one change.
This patch incorporates feedback from samsonov, and refactors the hacky darwin code out of the root CMakeLists.txt and int config-ix.cmake.
Reviewers: zaks.anna, bogner, kubabrecka, chandlerc, samsonov
Subscribers: jevinskie, filcab, llvm-commits
Differential Revision: http://reviews.llvm.org/D11820
llvm-svn: 244948
2015-08-14 04:38:16 +08:00
|
|
|
ALL_UBSAN_SUPPORTED_ARCH
|
|
|
|
SANITIZER_COMMON_SUPPORTED_ARCH)
|
2016-01-27 17:28:01 +08:00
|
|
|
list_intersect(SAFESTACK_SUPPORTED_ARCH
|
[CMake] Add experimental support for building compiler-rt for iOS
Summary:
This is a reunification of three separate reviews D11073, D11082, D11083.
Having them separate was not constructive even though the patches were smaller because it led to fragmented conversations, and this is really all about one change.
This patch incorporates feedback from samsonov, and refactors the hacky darwin code out of the root CMakeLists.txt and int config-ix.cmake.
Reviewers: zaks.anna, bogner, kubabrecka, chandlerc, samsonov
Subscribers: jevinskie, filcab, llvm-commits
Differential Revision: http://reviews.llvm.org/D11820
llvm-svn: 244948
2015-08-14 04:38:16 +08:00
|
|
|
ALL_SAFESTACK_SUPPORTED_ARCH
|
|
|
|
SANITIZER_COMMON_SUPPORTED_ARCH)
|
2016-01-27 17:28:01 +08:00
|
|
|
list_intersect(CFI_SUPPORTED_ARCH
|
2015-12-16 07:00:33 +08:00
|
|
|
ALL_CFI_SUPPORTED_ARCH
|
|
|
|
SANITIZER_COMMON_SUPPORTED_ARCH)
|
2016-04-22 05:32:25 +08:00
|
|
|
list_intersect(ESAN_SUPPORTED_ARCH
|
|
|
|
ALL_ESAN_SUPPORTED_ARCH
|
|
|
|
SANITIZER_COMMON_SUPPORTED_ARCH)
|
[sanitizer] Initial implementation of a Hardened Allocator
Summary:
This is an initial implementation of a Hardened Allocator based on Sanitizer Common's CombinedAllocator.
It aims at mitigating heap based vulnerabilities by adding several features to the base allocator, while staying relatively fast.
The following were implemented:
- additional consistency checks on the allocation function parameters and on the heap chunks;
- use of checksum protected chunk header, to detect corruption;
- randomness to the allocator base;
- delayed freelist (quarantine), to mitigate use after free and overall determinism.
Additional mitigations are in the works.
Reviewers: eugenis, aizatsky, pcc, krasin, vitalybuka, glider, dvyukov, kcc
Subscribers: kubabrecka, filcab, llvm-commits
Differential Revision: http://reviews.llvm.org/D20084
llvm-svn: 271968
2016-06-07 09:20:26 +08:00
|
|
|
list_intersect(SCUDO_SUPPORTED_ARCH
|
|
|
|
ALL_SCUDO_SUPPORTED_ARCH
|
|
|
|
SANITIZER_COMMON_SUPPORTED_ARCH)
|
[CMake] Add experimental support for building compiler-rt for iOS
Summary:
This is a reunification of three separate reviews D11073, D11082, D11083.
Having them separate was not constructive even though the patches were smaller because it led to fragmented conversations, and this is really all about one change.
This patch incorporates feedback from samsonov, and refactors the hacky darwin code out of the root CMakeLists.txt and int config-ix.cmake.
Reviewers: zaks.anna, bogner, kubabrecka, chandlerc, samsonov
Subscribers: jevinskie, filcab, llvm-commits
Differential Revision: http://reviews.llvm.org/D11820
llvm-svn: 244948
2015-08-14 04:38:16 +08:00
|
|
|
else()
|
|
|
|
# Architectures supported by compiler-rt libraries.
|
|
|
|
filter_available_targets(SANITIZER_COMMON_SUPPORTED_ARCH
|
|
|
|
${ALL_SANITIZER_COMMON_SUPPORTED_ARCH})
|
|
|
|
# LSan and UBSan common files should be available on all architectures
|
|
|
|
# supported by other sanitizers (even if they build into dummy object files).
|
|
|
|
filter_available_targets(LSAN_COMMON_SUPPORTED_ARCH
|
|
|
|
${SANITIZER_COMMON_SUPPORTED_ARCH})
|
|
|
|
filter_available_targets(UBSAN_COMMON_SUPPORTED_ARCH
|
|
|
|
${SANITIZER_COMMON_SUPPORTED_ARCH})
|
|
|
|
filter_available_targets(ASAN_SUPPORTED_ARCH ${ALL_ASAN_SUPPORTED_ARCH})
|
|
|
|
filter_available_targets(DFSAN_SUPPORTED_ARCH ${ALL_DFSAN_SUPPORTED_ARCH})
|
|
|
|
filter_available_targets(LSAN_SUPPORTED_ARCH ${ALL_LSAN_SUPPORTED_ARCH})
|
|
|
|
filter_available_targets(MSAN_SUPPORTED_ARCH ${ALL_MSAN_SUPPORTED_ARCH})
|
|
|
|
filter_available_targets(PROFILE_SUPPORTED_ARCH ${ALL_PROFILE_SUPPORTED_ARCH})
|
|
|
|
filter_available_targets(TSAN_SUPPORTED_ARCH ${ALL_TSAN_SUPPORTED_ARCH})
|
|
|
|
filter_available_targets(UBSAN_SUPPORTED_ARCH ${ALL_UBSAN_SUPPORTED_ARCH})
|
|
|
|
filter_available_targets(SAFESTACK_SUPPORTED_ARCH
|
|
|
|
${ALL_SAFESTACK_SUPPORTED_ARCH})
|
2015-12-16 07:00:33 +08:00
|
|
|
filter_available_targets(CFI_SUPPORTED_ARCH ${ALL_CFI_SUPPORTED_ARCH})
|
2016-04-22 05:32:25 +08:00
|
|
|
filter_available_targets(ESAN_SUPPORTED_ARCH ${ALL_ESAN_SUPPORTED_ARCH})
|
[sanitizer] Initial implementation of a Hardened Allocator
Summary:
This is an initial implementation of a Hardened Allocator based on Sanitizer Common's CombinedAllocator.
It aims at mitigating heap based vulnerabilities by adding several features to the base allocator, while staying relatively fast.
The following were implemented:
- additional consistency checks on the allocation function parameters and on the heap chunks;
- use of checksum protected chunk header, to detect corruption;
- randomness to the allocator base;
- delayed freelist (quarantine), to mitigate use after free and overall determinism.
Additional mitigations are in the works.
Reviewers: eugenis, aizatsky, pcc, krasin, vitalybuka, glider, dvyukov, kcc
Subscribers: kubabrecka, filcab, llvm-commits
Differential Revision: http://reviews.llvm.org/D20084
llvm-svn: 271968
2016-06-07 09:20:26 +08:00
|
|
|
filter_available_targets(SCUDO_SUPPORTED_ARCH
|
|
|
|
${ALL_SCUDO_SUPPORTED_ARCH})
|
[CMake] Add experimental support for building compiler-rt for iOS
Summary:
This is a reunification of three separate reviews D11073, D11082, D11083.
Having them separate was not constructive even though the patches were smaller because it led to fragmented conversations, and this is really all about one change.
This patch incorporates feedback from samsonov, and refactors the hacky darwin code out of the root CMakeLists.txt and int config-ix.cmake.
Reviewers: zaks.anna, bogner, kubabrecka, chandlerc, samsonov
Subscribers: jevinskie, filcab, llvm-commits
Differential Revision: http://reviews.llvm.org/D11820
llvm-svn: 244948
2015-08-14 04:38:16 +08:00
|
|
|
endif()
|
|
|
|
|
2016-01-23 04:26:10 +08:00
|
|
|
if (MSVC)
|
|
|
|
# See if the DIA SDK is available and usable.
|
|
|
|
set(MSVC_DIA_SDK_DIR "$ENV{VSINSTALLDIR}DIA SDK")
|
|
|
|
if (IS_DIRECTORY ${MSVC_DIA_SDK_DIR})
|
|
|
|
set(CAN_SYMBOLIZE 1)
|
|
|
|
else()
|
|
|
|
set(CAN_SYMBOLIZE 0)
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
set(CAN_SYMBOLIZE 1)
|
|
|
|
endif()
|
|
|
|
|
[CMake] Add experimental support for building compiler-rt for iOS
Summary:
This is a reunification of three separate reviews D11073, D11082, D11083.
Having them separate was not constructive even though the patches were smaller because it led to fragmented conversations, and this is really all about one change.
This patch incorporates feedback from samsonov, and refactors the hacky darwin code out of the root CMakeLists.txt and int config-ix.cmake.
Reviewers: zaks.anna, bogner, kubabrecka, chandlerc, samsonov
Subscribers: jevinskie, filcab, llvm-commits
Differential Revision: http://reviews.llvm.org/D11820
llvm-svn: 244948
2015-08-14 04:38:16 +08:00
|
|
|
message(STATUS "Compiler-RT supported architectures: ${COMPILER_RT_SUPPORTED_ARCH}")
|
2014-08-09 06:01:20 +08:00
|
|
|
|
|
|
|
if(ANDROID)
|
|
|
|
set(OS_NAME "Android")
|
|
|
|
else()
|
|
|
|
set(OS_NAME "${CMAKE_SYSTEM_NAME}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (SANITIZER_COMMON_SUPPORTED_ARCH AND NOT LLVM_USE_SANITIZER AND
|
|
|
|
(OS_NAME MATCHES "Android|Darwin|Linux|FreeBSD" OR
|
2015-07-02 09:44:34 +08:00
|
|
|
(OS_NAME MATCHES "Windows" AND MSVC)))
|
2015-12-10 08:40:58 +08:00
|
|
|
set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)
|
|
|
|
else()
|
|
|
|
set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)
|
2014-08-09 06:01:20 +08:00
|
|
|
endif()
|
|
|
|
|
2016-05-28 05:29:31 +08:00
|
|
|
if (COMPILER_RT_HAS_SANITIZER_COMMON)
|
2015-12-10 08:40:58 +08:00
|
|
|
set(COMPILER_RT_HAS_INTERCEPTION TRUE)
|
|
|
|
else()
|
|
|
|
set(COMPILER_RT_HAS_INTERCEPTION FALSE)
|
2015-07-02 09:44:34 +08:00
|
|
|
endif()
|
|
|
|
|
2016-05-28 05:29:31 +08:00
|
|
|
if (COMPILER_RT_HAS_SANITIZER_COMMON AND ASAN_SUPPORTED_ARCH)
|
2015-12-10 08:40:58 +08:00
|
|
|
set(COMPILER_RT_HAS_ASAN TRUE)
|
|
|
|
else()
|
|
|
|
set(COMPILER_RT_HAS_ASAN FALSE)
|
2014-08-09 06:01:20 +08:00
|
|
|
endif()
|
|
|
|
|
2015-02-04 02:40:34 +08:00
|
|
|
if (OS_NAME MATCHES "Linux|FreeBSD|Windows")
|
2015-12-10 08:40:58 +08:00
|
|
|
set(COMPILER_RT_ASAN_HAS_STATIC_RUNTIME TRUE)
|
|
|
|
else()
|
|
|
|
set(COMPILER_RT_ASAN_HAS_STATIC_RUNTIME FALSE)
|
2014-12-18 07:14:01 +08:00
|
|
|
endif()
|
|
|
|
|
2014-08-09 06:01:20 +08:00
|
|
|
# TODO: Add builtins support.
|
|
|
|
|
2015-12-10 08:40:58 +08:00
|
|
|
if (COMPILER_RT_HAS_SANITIZER_COMMON AND DFSAN_SUPPORTED_ARCH AND
|
2014-08-09 06:01:20 +08:00
|
|
|
OS_NAME MATCHES "Linux")
|
2015-12-10 08:40:58 +08:00
|
|
|
set(COMPILER_RT_HAS_DFSAN TRUE)
|
|
|
|
else()
|
|
|
|
set(COMPILER_RT_HAS_DFSAN FALSE)
|
2014-08-09 06:01:20 +08:00
|
|
|
endif()
|
|
|
|
|
2015-12-10 08:40:58 +08:00
|
|
|
if (COMPILER_RT_HAS_SANITIZER_COMMON AND LSAN_SUPPORTED_ARCH AND
|
|
|
|
OS_NAME MATCHES "Linux|FreeBSD")
|
|
|
|
set(COMPILER_RT_HAS_LSAN TRUE)
|
|
|
|
else()
|
|
|
|
set(COMPILER_RT_HAS_LSAN FALSE)
|
2014-08-09 06:01:20 +08:00
|
|
|
endif()
|
|
|
|
|
2015-12-10 08:40:58 +08:00
|
|
|
if (COMPILER_RT_HAS_SANITIZER_COMMON AND MSAN_SUPPORTED_ARCH AND
|
2014-08-09 06:01:20 +08:00
|
|
|
OS_NAME MATCHES "Linux")
|
2015-12-10 08:40:58 +08:00
|
|
|
set(COMPILER_RT_HAS_MSAN TRUE)
|
|
|
|
else()
|
|
|
|
set(COMPILER_RT_HAS_MSAN FALSE)
|
2014-08-09 06:01:20 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if (PROFILE_SUPPORTED_ARCH AND
|
2016-01-06 01:27:01 +08:00
|
|
|
OS_NAME MATCHES "Darwin|Linux|FreeBSD|Windows")
|
2015-12-10 08:40:58 +08:00
|
|
|
set(COMPILER_RT_HAS_PROFILE TRUE)
|
|
|
|
else()
|
|
|
|
set(COMPILER_RT_HAS_PROFILE FALSE)
|
2014-08-09 06:01:20 +08:00
|
|
|
endif()
|
|
|
|
|
2015-12-10 08:40:58 +08:00
|
|
|
if (COMPILER_RT_HAS_SANITIZER_COMMON AND TSAN_SUPPORTED_ARCH AND
|
2015-12-03 19:02:43 +08:00
|
|
|
OS_NAME MATCHES "Darwin|Linux|FreeBSD")
|
2015-12-10 08:40:58 +08:00
|
|
|
set(COMPILER_RT_HAS_TSAN TRUE)
|
|
|
|
else()
|
|
|
|
set(COMPILER_RT_HAS_TSAN FALSE)
|
2014-08-09 06:01:20 +08:00
|
|
|
endif()
|
|
|
|
|
2015-12-10 08:40:58 +08:00
|
|
|
if (COMPILER_RT_HAS_SANITIZER_COMMON AND UBSAN_SUPPORTED_ARCH AND
|
2015-07-02 09:44:34 +08:00
|
|
|
OS_NAME MATCHES "Darwin|Linux|FreeBSD|Windows")
|
2015-12-10 08:40:58 +08:00
|
|
|
set(COMPILER_RT_HAS_UBSAN TRUE)
|
|
|
|
else()
|
|
|
|
set(COMPILER_RT_HAS_UBSAN FALSE)
|
2014-08-09 06:01:20 +08:00
|
|
|
endif()
|
|
|
|
|
2015-12-10 08:40:58 +08:00
|
|
|
if (COMPILER_RT_HAS_SANITIZER_COMMON AND SAFESTACK_SUPPORTED_ARCH AND
|
2015-06-16 05:08:47 +08:00
|
|
|
OS_NAME MATCHES "Darwin|Linux|FreeBSD")
|
2015-12-10 08:40:58 +08:00
|
|
|
set(COMPILER_RT_HAS_SAFESTACK TRUE)
|
|
|
|
else()
|
|
|
|
set(COMPILER_RT_HAS_SAFESTACK FALSE)
|
2015-06-16 05:08:47 +08:00
|
|
|
endif()
|
2015-12-16 07:00:33 +08:00
|
|
|
|
|
|
|
if (COMPILER_RT_HAS_SANITIZER_COMMON AND CFI_SUPPORTED_ARCH AND
|
|
|
|
OS_NAME MATCHES "Linux")
|
|
|
|
set(COMPILER_RT_HAS_CFI TRUE)
|
|
|
|
else()
|
|
|
|
set(COMPILER_RT_HAS_CFI FALSE)
|
|
|
|
endif()
|
2016-04-22 05:32:25 +08:00
|
|
|
|
|
|
|
if (COMPILER_RT_HAS_SANITIZER_COMMON AND ESAN_SUPPORTED_ARCH AND
|
|
|
|
OS_NAME MATCHES "Linux")
|
|
|
|
set(COMPILER_RT_HAS_ESAN TRUE)
|
|
|
|
else()
|
|
|
|
set(COMPILER_RT_HAS_ESAN FALSE)
|
|
|
|
endif()
|
[sanitizer] Initial implementation of a Hardened Allocator
Summary:
This is an initial implementation of a Hardened Allocator based on Sanitizer Common's CombinedAllocator.
It aims at mitigating heap based vulnerabilities by adding several features to the base allocator, while staying relatively fast.
The following were implemented:
- additional consistency checks on the allocation function parameters and on the heap chunks;
- use of checksum protected chunk header, to detect corruption;
- randomness to the allocator base;
- delayed freelist (quarantine), to mitigate use after free and overall determinism.
Additional mitigations are in the works.
Reviewers: eugenis, aizatsky, pcc, krasin, vitalybuka, glider, dvyukov, kcc
Subscribers: kubabrecka, filcab, llvm-commits
Differential Revision: http://reviews.llvm.org/D20084
llvm-svn: 271968
2016-06-07 09:20:26 +08:00
|
|
|
|
|
|
|
if (COMPILER_RT_HAS_SANITIZER_COMMON AND SCUDO_SUPPORTED_ARCH AND
|
|
|
|
OS_NAME MATCHES "Linux")
|
|
|
|
set(COMPILER_RT_HAS_SCUDO TRUE)
|
|
|
|
else()
|
|
|
|
set(COMPILER_RT_HAS_SCUDO FALSE)
|
|
|
|
endif()
|
|
|
|
|