2015-02-26 07:07:32 +08:00
|
|
|
include(CMakePushCheckState)
|
2017-07-28 11:39:38 +08:00
|
|
|
include(CheckCCompilerFlag)
|
2014-02-18 15:26:58 +08:00
|
|
|
include(CheckCXXCompilerFlag)
|
2020-01-30 00:19:26 +08:00
|
|
|
include(CheckIncludeFiles)
|
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
|
|
|
|
2021-04-30 06:48:46 +08:00
|
|
|
function(compiler_rt_check_linker_flag flag out_var)
|
2015-05-06 04:13:39 +08:00
|
|
|
cmake_push_check_state()
|
|
|
|
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${flag}")
|
|
|
|
check_cxx_compiler_flag("" ${out_var})
|
|
|
|
cmake_pop_check_state()
|
|
|
|
endfunction()
|
|
|
|
|
2019-01-29 03:26:41 +08:00
|
|
|
check_library_exists(c fopen "" COMPILER_RT_HAS_LIBC)
|
2018-07-15 11:05:20 +08:00
|
|
|
if (COMPILER_RT_USE_BUILTINS_LIBRARY)
|
2018-05-23 06:58:48 +08:00
|
|
|
include(HandleCompilerRT)
|
2020-09-29 08:37:20 +08:00
|
|
|
find_compiler_rt_library(builtins COMPILER_RT_BUILTINS_LIBRARY
|
|
|
|
FLAGS ${SANITIZER_COMMON_FLAGS})
|
2021-08-06 16:47:38 +08:00
|
|
|
# TODO(PR51389): We should check COMPILER_RT_BUILTINS_LIBRARY and report an
|
|
|
|
# error if the value is NOTFOUND rather than silenty continuing but we first
|
|
|
|
# need to fix find_compiler_rt_library on Darwin.
|
2018-05-23 06:58:48 +08:00
|
|
|
else()
|
2017-08-01 06:46:43 +08:00
|
|
|
if (ANDROID)
|
|
|
|
check_library_exists(gcc __gcc_personality_v0 "" COMPILER_RT_HAS_GCC_LIB)
|
|
|
|
else()
|
|
|
|
check_library_exists(gcc_s __gcc_personality_v0 "" COMPILER_RT_HAS_GCC_S_LIB)
|
|
|
|
endif()
|
2017-07-28 11:39:38 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
check_c_compiler_flag(-nodefaultlibs COMPILER_RT_HAS_NODEFAULTLIBS_FLAG)
|
|
|
|
if (COMPILER_RT_HAS_NODEFAULTLIBS_FLAG)
|
|
|
|
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nodefaultlibs")
|
|
|
|
if (COMPILER_RT_HAS_LIBC)
|
|
|
|
list(APPEND CMAKE_REQUIRED_LIBRARIES c)
|
|
|
|
endif ()
|
2018-07-15 11:05:20 +08:00
|
|
|
if (COMPILER_RT_USE_BUILTINS_LIBRARY)
|
2021-08-06 16:47:38 +08:00
|
|
|
# TODO: remote this check once we address PR51389.
|
|
|
|
if (${COMPILER_RT_BUILTINS_LIBRARY})
|
|
|
|
list(APPEND CMAKE_REQUIRED_LIBRARIES "${COMPILER_RT_BUILTINS_LIBRARY}")
|
|
|
|
endif()
|
2017-07-28 11:39:38 +08:00
|
|
|
elseif (COMPILER_RT_HAS_GCC_S_LIB)
|
|
|
|
list(APPEND CMAKE_REQUIRED_LIBRARIES gcc_s)
|
2017-08-01 06:46:43 +08:00
|
|
|
elseif (COMPILER_RT_HAS_GCC_LIB)
|
|
|
|
list(APPEND CMAKE_REQUIRED_LIBRARIES gcc)
|
2017-07-28 11:39:38 +08:00
|
|
|
endif ()
|
2018-09-26 14:53:01 +08:00
|
|
|
if (MINGW)
|
|
|
|
# Mingw64 requires quite a few "C" runtime libraries in order for basic
|
|
|
|
# programs to link successfully with -nodefaultlibs.
|
|
|
|
if (COMPILER_RT_USE_BUILTINS_LIBRARY)
|
|
|
|
set(MINGW_RUNTIME ${COMPILER_RT_BUILTINS_LIBRARY})
|
|
|
|
else ()
|
|
|
|
set(MINGW_RUNTIME gcc_s gcc)
|
|
|
|
endif()
|
|
|
|
set(MINGW_LIBRARIES mingw32 ${MINGW_RUNTIME} moldname mingwex msvcrt advapi32
|
|
|
|
shell32 user32 kernel32 mingw32 ${MINGW_RUNTIME}
|
|
|
|
moldname mingwex msvcrt)
|
|
|
|
list(APPEND CMAKE_REQUIRED_LIBRARIES ${MINGW_LIBRARIES})
|
|
|
|
endif()
|
2017-07-28 11:39:38 +08:00
|
|
|
endif ()
|
|
|
|
|
2014-02-18 15:26:58 +08:00
|
|
|
# CodeGen options.
|
2018-10-31 03:19:47 +08:00
|
|
|
check_c_compiler_flag(-ffreestanding COMPILER_RT_HAS_FFREESTANDING_FLAG)
|
2021-09-15 16:24:37 +08:00
|
|
|
check_c_compiler_flag(-fomit-frame-pointer COMPILER_RT_HAS_OMIT_FRAME_POINTER_FLAG)
|
2019-05-11 03:23:56 +08:00
|
|
|
check_c_compiler_flag(-std=c11 COMPILER_RT_HAS_STD_C11_FLAG)
|
2014-02-18 15:26:58 +08:00
|
|
|
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 15:26:58 +08:00
|
|
|
check_cxx_compiler_flag("-Werror -fno-function-sections" COMPILER_RT_HAS_FNO_FUNCTION_SECTIONS_FLAG)
|
2019-08-15 12:42:15 +08:00
|
|
|
check_cxx_compiler_flag(-std=c++14 COMPILER_RT_HAS_STD_CXX14_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)
|
2020-03-10 06:25:41 +08:00
|
|
|
check_cxx_compiler_flag(-fno-profile-generate COMPILER_RT_HAS_FNO_PROFILE_GENERATE_FLAG)
|
|
|
|
check_cxx_compiler_flag(-fno-profile-instr-generate COMPILER_RT_HAS_FNO_PROFILE_INSTR_GENERATE_FLAG)
|
|
|
|
check_cxx_compiler_flag(-fno-profile-instr-use COMPILER_RT_HAS_FNO_PROFILE_INSTR_USE_FLAG)
|
2015-12-10 06:26:38 +08:00
|
|
|
check_cxx_compiler_flag("-Werror -msse3" COMPILER_RT_HAS_MSSE3_FLAG)
|
2017-01-11 00:39:36 +08:00
|
|
|
check_cxx_compiler_flag("-Werror -msse4.2" COMPILER_RT_HAS_MSSE4_2_FLAG)
|
2015-12-08 07:21:36 +08:00
|
|
|
check_cxx_compiler_flag(--sysroot=. COMPILER_RT_HAS_SYSROOT_FLAG)
|
[scudo] Refactor of CRC32 and ARM runtime CRC32 detection
Summary:
ARM & AArch64 runtime detection for hardware support of CRC32 has been added
via check of the AT_HWVAL auxiliary vector.
Following Michal's suggestions in D28417, the CRC32 code has been further
changed and looks better now. When compiled with full relro (which is strongly
suggested to benefit from additional hardening), the weak symbol for
computeHardwareCRC32 is read-only and the assembly generated is fairly clean
and straight forward. As suggested, an additional optimization is to skip
the runtime check if SSE 4.2 has been enabled globally, as opposed to only
for scudo_crc32.cpp.
scudo_crc32.h has no purpose anymore and was removed.
Reviewers: alekseyshl, kcc, rengolin, mgorny, phosek
Reviewed By: rengolin, mgorny
Subscribers: aemerson, rengolin, llvm-commits
Differential Revision: https://reviews.llvm.org/D28574
llvm-svn: 292409
2017-01-19 01:11:17 +08:00
|
|
|
check_cxx_compiler_flag("-Werror -mcrc" COMPILER_RT_HAS_MCRC_FLAG)
|
2019-06-18 21:26:27 +08:00
|
|
|
check_cxx_compiler_flag(-fno-partial-inlining COMPILER_RT_HAS_FNO_PARTIAL_INLINING_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)
|
2016-06-18 02:30:37 +08:00
|
|
|
check_cxx_compiler_flag("-Werror -Wunused-parameter" COMPILER_RT_HAS_WUNUSED_PARAMETER_FLAG)
|
2017-01-05 11:41:41 +08:00
|
|
|
check_cxx_compiler_flag("-Werror -Wcovered-switch-default" COMPILER_RT_HAS_WCOVERED_SWITCH_DEFAULT_FLAG)
|
2020-07-23 08:44:52 +08:00
|
|
|
check_cxx_compiler_flag("-Werror -Wsuggest-override" COMPILER_RT_HAS_WSUGGEST_OVERRIDE_FLAG)
|
2019-05-01 11:30:51 +08:00
|
|
|
check_cxx_compiler_flag(-Wno-pedantic COMPILER_RT_HAS_WNO_PEDANTIC)
|
2021-08-13 01:37:29 +08:00
|
|
|
check_cxx_compiler_flag(-Wno-format COMPILER_RT_HAS_WNO_FORMAT)
|
|
|
|
check_cxx_compiler_flag(-Wno-format-pedantic COMPILER_RT_HAS_WNO_FORMAT_PEDANTIC)
|
2014-02-18 15:26:58 +08:00
|
|
|
|
2016-06-18 01:48:52 +08:00
|
|
|
check_cxx_compiler_flag(/W4 COMPILER_RT_HAS_W4_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)
|
2016-06-18 02:12:50 +08:00
|
|
|
check_cxx_compiler_flag(/wd4221 COMPILER_RT_HAS_WD4221_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
|
|
|
|
2020-01-30 00:19:26 +08:00
|
|
|
# Includes.
|
2020-07-21 01:13:38 +08:00
|
|
|
check_cxx_compiler_flag(-nostdinc++ COMPILER_RT_HAS_NOSTDINCXX_FLAG)
|
2020-10-31 07:16:09 +08:00
|
|
|
check_cxx_compiler_flag(-nostdlib++ COMPILER_RT_HAS_NOSTDLIBXX_FLAG)
|
2020-07-21 01:13:38 +08:00
|
|
|
check_include_files("sys/auxv.h" COMPILER_RT_HAS_AUXV)
|
2020-01-30 00:19:26 +08:00
|
|
|
|
2014-03-04 21:28:21 +08:00
|
|
|
# Libraries.
|
|
|
|
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)
|
Fix XRayTest link on FreeBSD (and likely NetBSD too)
Summary:
As reported on llvm-testers, during 8.0.0-rc1 testing I got errors while
building of `XRayTest`, during `check-all`:
```
[100%] Generating XRayTest-x86_64-Test
/home/dim/llvm/8.0.0/rc1/Phase3/Release/llvmCore-8.0.0-rc1.obj/./lib/libLLVMSupport.a(Signals.cpp.o): In function `llvm::sys::PrintStackTrace(llvm::raw_ostream&)':
Signals.cpp:(.text._ZN4llvm3sys15PrintStackTraceERNS_11raw_ostreamE+0x24): undefined reference to `backtrace'
Signals.cpp:(.text._ZN4llvm3sys15PrintStackTraceERNS_11raw_ostreamE+0x254): undefined reference to `llvm::itaniumDemangle(char const*, char*, unsigned long*, int*)'
clang-8: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[3]: *** [projects/compiler-rt/lib/xray/tests/unit/CMakeFiles/TXRayTest-x86_64-Test.dir/build.make:73: projects/compiler-rt/lib/xray/tests/unit/XRayTest-x86_64-Test] Error 1
gmake[3]: Target 'projects/compiler-rt/lib/xray/tests/unit/CMakeFiles/TXRayTest-x86_64-Test.dir/build' not remade because of errors.
gmake[2]: *** [CMakeFiles/Makefile2:33513: projects/compiler-rt/lib/xray/tests/unit/CMakeFiles/TXRayTest-x86_64-Test.dir/all] Error 2
gmake[2]: Target 'CMakeFiles/check-all.dir/all' not remade because of errors.
gmake[1]: *** [CMakeFiles/Makefile2:737: CMakeFiles/check-all.dir/rule] Error 2
gmake[1]: Target 'check-all' not remade because of errors.
gmake: *** [Makefile:277: check-all] Error 2
[Release Phase3] check-all failed
```
This is because the `backtrace` function requires `-lexecinfo` on BSD
platforms. To fix this, detect the `execinfo` library in
`cmake/config-ix.cmake`, and add it to the unit test link flags.
Additionally, since the code in `sys::PrintStackTrace` makes use of
`itaniumDemangle`, also add `-lLLVMDemangle`. (Note that this is more
of a general problem with libLLVMSupport, but I'm looking for a quick
fix now so it can be merged to the 8.0 branch.)
Reviewers: dberris, hans, mgorny, samsonov
Reviewed By: dberris
Subscribers: krytarowski, delcypher, erik.pilkington, #sanitizers, emaste, llvm-commits
Differential Revision: https://reviews.llvm.org/D57181
llvm-svn: 352234
2019-01-26 03:36:47 +08:00
|
|
|
check_library_exists(execinfo backtrace "" COMPILER_RT_HAS_LIBEXECINFO)
|
2018-09-20 13:22:37 +08:00
|
|
|
|
|
|
|
# Look for terminfo library, used in unittests that depend on LLVMSupport.
|
2020-09-01 06:11:39 +08:00
|
|
|
if(LLVM_ENABLE_TERMINFO STREQUAL FORCE_ON)
|
|
|
|
set(MAYBE_REQUIRED REQUIRED)
|
|
|
|
else()
|
|
|
|
set(MAYBE_REQUIRED)
|
|
|
|
endif()
|
2020-08-20 01:30:32 +08:00
|
|
|
if(LLVM_ENABLE_TERMINFO)
|
2020-09-01 06:11:39 +08:00
|
|
|
find_library(COMPILER_RT_TERMINFO_LIB NAMES terminfo tinfo curses ncurses ncursesw ${MAYBE_REQUIRED})
|
|
|
|
endif()
|
|
|
|
if(COMPILER_RT_TERMINFO_LIB)
|
|
|
|
set(LLVM_ENABLE_TERMINFO 1)
|
|
|
|
else()
|
|
|
|
set(LLVM_ENABLE_TERMINFO 0)
|
2018-09-20 13:22:37 +08:00
|
|
|
endif()
|
|
|
|
|
2017-08-01 06:46:43 +08:00
|
|
|
if (ANDROID AND COMPILER_RT_HAS_LIBDL)
|
|
|
|
# Android's libstdc++ has a dependency on libdl.
|
|
|
|
list(APPEND CMAKE_REQUIRED_LIBRARIES dl)
|
|
|
|
endif()
|
2018-05-23 02:33:27 +08:00
|
|
|
check_library_exists(c++ __cxa_throw "" COMPILER_RT_HAS_LIBCXX)
|
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.
|
2021-04-30 06:48:46 +08:00
|
|
|
compiler_rt_check_linker_flag("-Wl,-z,text" COMPILER_RT_HAS_Z_TEXT)
|
|
|
|
compiler_rt_check_linker_flag("-fuse-ld=lld" COMPILER_RT_HAS_FUSE_LD_LLD_FLAG)
|
2019-03-01 09:45:01 +08:00
|
|
|
|
2020-07-28 19:21:36 +08:00
|
|
|
set(VERS_COMPAT_OPTION "-Wl,-z,gnu-version-script-compat")
|
2021-04-30 06:48:46 +08:00
|
|
|
compiler_rt_check_linker_flag("${VERS_COMPAT_OPTION}" COMPILER_RT_HAS_GNU_VERSION_SCRIPT_COMPAT)
|
2020-07-28 19:21:36 +08:00
|
|
|
|
|
|
|
set(DUMMY_VERS ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/dummy.vers)
|
|
|
|
file(WRITE ${DUMMY_VERS} "{};")
|
|
|
|
set(VERS_OPTION "-Wl,--version-script,${DUMMY_VERS}")
|
|
|
|
if(COMPILER_RT_HAS_GNU_VERSION_SCRIPT_COMPAT)
|
|
|
|
# Solaris 11.4 ld only supports --version-script with
|
2021-05-21 02:09:53 +08:00
|
|
|
# -z gnu-version-script-compat.
|
2020-07-28 19:21:36 +08:00
|
|
|
string(APPEND VERS_OPTION " ${VERS_COMPAT_OPTION}")
|
|
|
|
endif()
|
2021-04-30 06:48:46 +08:00
|
|
|
compiler_rt_check_linker_flag("${VERS_OPTION}" COMPILER_RT_HAS_VERSION_SCRIPT)
|
2020-07-28 19:21:36 +08:00
|
|
|
|
2015-05-06 04:13:39 +08:00
|
|
|
if(ANDROID)
|
2021-04-30 06:48:46 +08:00
|
|
|
compiler_rt_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)
|
|
|
|
|
2018-06-17 17:51:33 +08:00
|
|
|
# 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 <stdio.h>\nint main() { printf(\"hello, world\"); }\n")
|
|
|
|
|
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()
|
|
|
|
|
2016-11-30 03:25:53 +08:00
|
|
|
# Returns a compiler and CFLAGS that should be used to run tests for the
|
|
|
|
# specific architecture. When cross-compiling, this is controled via
|
|
|
|
# COMPILER_RT_TEST_COMPILER and COMPILER_RT_TEST_COMPILER_CFLAGS.
|
|
|
|
macro(get_test_cc_for_arch arch cc_out cflags_out)
|
2021-02-01 07:51:38 +08:00
|
|
|
if(ANDROID OR ${arch} MATCHES "arm|aarch64|riscv32|riscv64")
|
2016-11-30 03:25:53 +08:00
|
|
|
# This is only true if we are cross-compiling.
|
|
|
|
# Build all tests with host compiler and use host tools.
|
|
|
|
set(${cc_out} ${COMPILER_RT_TEST_COMPILER})
|
|
|
|
set(${cflags_out} ${COMPILER_RT_TEST_COMPILER_CFLAGS})
|
|
|
|
else()
|
|
|
|
get_target_flags_for_arch(${arch} ${cflags_out})
|
|
|
|
if(APPLE)
|
|
|
|
list(APPEND ${cflags_out} ${DARWIN_osx_CFLAGS})
|
|
|
|
endif()
|
|
|
|
string(REPLACE ";" " " ${cflags_out} "${${cflags_out}}")
|
|
|
|
endif()
|
|
|
|
endmacro()
|
|
|
|
|
2019-10-02 07:08:18 +08:00
|
|
|
# Returns CFLAGS that should be used to run tests for the
|
|
|
|
# specific apple platform and architecture.
|
|
|
|
function(get_test_cflags_for_apple_platform platform arch cflags_out)
|
|
|
|
is_valid_apple_platform("${platform}" is_valid_platform)
|
|
|
|
if (NOT is_valid_platform)
|
|
|
|
message(FATAL_ERROR "\"${platform}\" is not a valid apple platform")
|
|
|
|
endif()
|
|
|
|
set(test_cflags "")
|
|
|
|
get_target_flags_for_arch(${arch} test_cflags)
|
2021-09-15 08:05:20 +08:00
|
|
|
|
|
|
|
if (NOT "${arch}" STREQUAL "arm64e")
|
|
|
|
list(APPEND test_cflags ${DARWIN_${platform}_CFLAGS})
|
|
|
|
else()
|
|
|
|
# arm64e is not currently ABI stable so we need to build for the
|
|
|
|
# OS version being tested. Rather than querying the device under test
|
|
|
|
# we use the SDK version which "should" be the same as the
|
|
|
|
# device under test (it is a configuration error for these not to match).
|
|
|
|
# FIXME(dliew): We can remove this if we build the runtimes with the appropriate
|
|
|
|
# deployment target for arm64e.
|
|
|
|
foreach (flag ${DARWIN_${platform}_CFLAGS})
|
|
|
|
if ("${flag}" MATCHES "^${DARWIN_${platform}_MIN_VER_FLAG}=.+")
|
|
|
|
# Find the SDK version
|
|
|
|
get_xcrun_platform_from_apple_platform("${platform}" xcrun_platform_name)
|
|
|
|
# TODO(dliew): Remove this check once get_xcrun_platform_from_apple_platform
|
|
|
|
# emits a fatal error for unrecognised platforms.
|
|
|
|
if (NOT "${xcrun_platform_name}" STREQUAL "")
|
|
|
|
find_darwin_sdk_version(platform_sdk_version "${xcrun_platform_name}")
|
|
|
|
# Patch flag with correct deployment target
|
|
|
|
set(replacement_flag "${DARWIN_${platform}_MIN_VER_FLAG}=${platform_sdk_version}")
|
|
|
|
list(APPEND test_cflags "${replacement_flag}")
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
# Copy through
|
|
|
|
list(APPEND test_cflags "${flag}")
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
endif()
|
|
|
|
|
2019-10-02 07:08:18 +08:00
|
|
|
string(REPLACE ";" " " test_cflags_str "${test_cflags}")
|
|
|
|
string(APPEND test_cflags_str "${COMPILER_RT_TEST_COMPILER_CFLAGS}")
|
|
|
|
set(${cflags_out} "${test_cflags_str}" PARENT_SCOPE)
|
|
|
|
endfunction()
|
|
|
|
|
2020-01-23 06:11:17 +08:00
|
|
|
function(get_capitalized_apple_platform platform platform_capitalized)
|
|
|
|
# TODO(dliew): Remove uses of this function. It exists to preserve needlessly complex
|
|
|
|
# directory naming conventions used by the Sanitizer lit test suites.
|
|
|
|
is_valid_apple_platform("${platform}" is_valid_platform)
|
|
|
|
if (NOT is_valid_platform)
|
|
|
|
message(FATAL_ERROR "\"${platform}\" is not a valid apple platform")
|
|
|
|
endif()
|
|
|
|
string(TOUPPER "${platform}" platform_upper)
|
|
|
|
string(REGEX REPLACE "OSSIM$" "OSSim" platform_upper_capitalized "${platform_upper}")
|
|
|
|
set(${platform_capitalized} "${platform_upper_capitalized}" PARENT_SCOPE)
|
|
|
|
endfunction()
|
|
|
|
|
2019-10-02 07:08:18 +08:00
|
|
|
function(is_valid_apple_platform platform is_valid_out)
|
|
|
|
set(is_valid FALSE)
|
|
|
|
if ("${platform}" STREQUAL "")
|
|
|
|
message(FATAL_ERROR "platform cannot be empty")
|
|
|
|
endif()
|
|
|
|
if ("${platform}" MATCHES "^(osx|((ios|watchos|tvos)(sim)?))$")
|
|
|
|
set(is_valid TRUE)
|
|
|
|
endif()
|
|
|
|
set(${is_valid_out} ${is_valid} PARENT_SCOPE)
|
|
|
|
endfunction()
|
|
|
|
|
2021-09-15 08:05:20 +08:00
|
|
|
# Maps the Apple platform name used in Compiler-rt's CMake code
|
|
|
|
# to the name recognised by xcrun's `--sdk` argument
|
|
|
|
function(get_xcrun_platform_from_apple_platform platform out_var)
|
|
|
|
set(xcrun_platform "")
|
|
|
|
if ("${platform}" STREQUAL "osx")
|
|
|
|
set(xcrun_platform "macosx")
|
|
|
|
elseif ("${platform}" STREQUAL "iossim")
|
|
|
|
set(xcrun_platform "iphonesimulator")
|
|
|
|
elseif ("${platform}" STREQUAL "ios")
|
|
|
|
set(xcrun_platform "iphoneos")
|
|
|
|
elseif ("${platform}" STREQUAL "watchossim")
|
|
|
|
set(xcrun_platform "watchsimulator")
|
|
|
|
elseif ("${platform}" STREQUAL "watchos")
|
|
|
|
set(xcrun_platform "watchos")
|
|
|
|
elseif ("${platform}" STREQUAL "tvossim")
|
|
|
|
set(xcrun_platform "appletvsimulator")
|
|
|
|
elseif ("${platform}" STREQUAL "tvos")
|
|
|
|
set(xcrun_platform "appletvos")
|
|
|
|
else()
|
|
|
|
# TODO(dliew): Make this an error.
|
|
|
|
message(WARNING "\"${platform}\" is not a handled apple platform")
|
|
|
|
endif()
|
|
|
|
set(${out_var} ${xcrun_platform} PARENT_SCOPE)
|
|
|
|
endfunction()
|
|
|
|
|
2021-07-28 01:44:14 +08:00
|
|
|
include(AllSupportedArchDefs)
|
2021-04-24 12:14:56 +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)
|
|
|
|
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)
|
|
|
|
|
2016-08-20 06:22:35 +08:00
|
|
|
if(NOT DARWIN_osx_SYSROOT)
|
2019-11-01 05:17:55 +08:00
|
|
|
message(WARNING "Could not determine OS X sysroot, trying /usr/include")
|
2016-08-20 06:22:35 +08:00
|
|
|
if(EXISTS /usr/include)
|
|
|
|
set(DARWIN_osx_SYSROOT /)
|
|
|
|
else()
|
|
|
|
message(ERROR "Could not detect OS X Sysroot. Either install Xcode or the Apple Command Line Tools")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2016-01-13 07:51:03 +08:00
|
|
|
if(COMPILER_RT_ENABLE_IOS)
|
|
|
|
list(APPEND DARWIN_EMBEDDED_PLATFORMS ios)
|
2020-02-15 02:28:05 +08:00
|
|
|
set(DARWIN_ios_MIN_VER 9.0)
|
2016-01-13 07:51:03 +08:00
|
|
|
set(DARWIN_ios_MIN_VER_FLAG -miphoneos-version-min)
|
|
|
|
set(DARWIN_ios_SANITIZER_MIN_VER_FLAG
|
2020-02-15 02:28:05 +08:00
|
|
|
${DARWIN_ios_MIN_VER_FLAG}=${DARWIN_ios_MIN_VER})
|
|
|
|
set(DARWIN_iossim_MIN_VER_FLAG -mios-simulator-version-min)
|
|
|
|
set(DARWIN_iossim_SANITIZER_MIN_VER_FLAG
|
|
|
|
${DARWIN_iossim_MIN_VER_FLAG}=${DARWIN_ios_MIN_VER})
|
2016-01-13 07:51:03 +08:00
|
|
|
endif()
|
|
|
|
if(COMPILER_RT_ENABLE_WATCHOS)
|
|
|
|
list(APPEND DARWIN_EMBEDDED_PLATFORMS watchos)
|
2020-02-15 02:28:05 +08:00
|
|
|
set(DARWIN_watchos_MIN_VER 2.0)
|
2016-01-13 07:51:03 +08:00
|
|
|
set(DARWIN_watchos_MIN_VER_FLAG -mwatchos-version-min)
|
|
|
|
set(DARWIN_watchos_SANITIZER_MIN_VER_FLAG
|
2020-02-15 02:28:05 +08:00
|
|
|
${DARWIN_watchos_MIN_VER_FLAG}=${DARWIN_watchos_MIN_VER})
|
|
|
|
set(DARWIN_watchossim_MIN_VER_FLAG -mwatchos-simulator-version-min)
|
|
|
|
set(DARWIN_watchossim_SANITIZER_MIN_VER_FLAG
|
|
|
|
${DARWIN_watchossim_MIN_VER_FLAG}=${DARWIN_watchos_MIN_VER})
|
2016-01-13 07:51:03 +08:00
|
|
|
endif()
|
|
|
|
if(COMPILER_RT_ENABLE_TVOS)
|
|
|
|
list(APPEND DARWIN_EMBEDDED_PLATFORMS tvos)
|
2020-02-15 02:28:05 +08:00
|
|
|
set(DARWIN_tvos_MIN_VER 9.0)
|
2016-01-13 07:51:03 +08:00
|
|
|
set(DARWIN_tvos_MIN_VER_FLAG -mtvos-version-min)
|
|
|
|
set(DARWIN_tvos_SANITIZER_MIN_VER_FLAG
|
2020-02-15 02:28:05 +08:00
|
|
|
${DARWIN_tvos_MIN_VER_FLAG}=${DARWIN_tvos_MIN_VER})
|
|
|
|
set(DARWIN_tvossim_MIN_VER_FLAG -mtvos-simulator-version-min)
|
|
|
|
set(DARWIN_tvossim_SANITIZER_MIN_VER_FLAG
|
|
|
|
${DARWIN_tvossim_MIN_VER_FLAG}=${DARWIN_tvos_MIN_VER})
|
2016-01-13 07:51:03 +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
|
|
|
|
|
|
|
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)
|
2017-11-28 19:49:22 +08:00
|
|
|
set(XRAY_SUPPORTED_OS osx)
|
2020-01-23 08:26:45 +08:00
|
|
|
set(FUZZER_SUPPORTED_OS osx)
|
2021-04-24 12:14:56 +08:00
|
|
|
set(ORC_SUPPORTED_OS osx)
|
2019-11-19 01:37:40 +08:00
|
|
|
|
|
|
|
# Note: In order to target x86_64h on OS X the minimum deployment target must
|
|
|
|
# be 10.8 or higher.
|
|
|
|
set(DEFAULT_SANITIZER_MIN_OSX_VERSION 10.10)
|
2020-02-15 03:01:02 +08:00
|
|
|
set(DARWIN_osx_MIN_VER_FLAG "-mmacosx-version-min")
|
[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)
|
2020-02-15 03:01:02 +08:00
|
|
|
string(REGEX MATCH "${DARWIN_osx_MIN_VER_FLAG}=([.0-9]+)"
|
[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
|
|
|
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()
|
2019-11-19 01:37:40 +08:00
|
|
|
set(SANITIZER_MIN_OSX_VERSION ${DEFAULT_SANITIZER_MIN_OSX_VERSION})
|
[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()
|
|
|
|
if(SANITIZER_MIN_OSX_VERSION VERSION_LESS "10.7")
|
2016-11-15 02:27:47 +08:00
|
|
|
message(FATAL_ERROR "macOS deployment target '${SANITIZER_MIN_OSX_VERSION}' is too old.")
|
|
|
|
endif()
|
2019-11-19 01:37:40 +08:00
|
|
|
if(SANITIZER_MIN_OSX_VERSION VERSION_GREATER ${DEFAULT_SANITIZER_MIN_OSX_VERSION})
|
|
|
|
message(WARNING "macOS deployment target '${SANITIZER_MIN_OSX_VERSION}' is too new, setting to '${DEFAULT_SANITIZER_MIN_OSX_VERSION}' instead.")
|
|
|
|
set(SANITIZER_MIN_OSX_VERSION ${DEFAULT_SANITIZER_MIN_OSX_VERSION})
|
[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()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# We're setting the flag manually for each target OS
|
|
|
|
set(CMAKE_OSX_DEPLOYMENT_TARGET "")
|
2019-01-23 02:59:25 +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
|
|
|
set(DARWIN_COMMON_CFLAGS -stdlib=libc++)
|
2017-01-10 12:33:04 +08:00
|
|
|
set(DARWIN_COMMON_LINK_FLAGS
|
[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
|
|
|
-stdlib=libc++
|
|
|
|
-lc++
|
|
|
|
-lc++abi)
|
2019-01-23 02:59:25 +08:00
|
|
|
|
2021-04-30 06:48:46 +08:00
|
|
|
compiler_rt_check_linker_flag("-fapplication-extension" COMPILER_RT_HAS_APP_EXTENSION)
|
2016-01-07 07:15:04 +08:00
|
|
|
if(COMPILER_RT_HAS_APP_EXTENSION)
|
2017-01-10 12:33:04 +08:00
|
|
|
list(APPEND DARWIN_COMMON_LINK_FLAGS "-fapplication-extension")
|
2016-01-07 07:15:04 +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
|
|
|
set(DARWIN_osx_CFLAGS
|
|
|
|
${DARWIN_COMMON_CFLAGS}
|
2020-02-15 03:01:02 +08:00
|
|
|
${DARWIN_osx_MIN_VER_FLAG}=${SANITIZER_MIN_OSX_VERSION})
|
2017-01-10 12:33:04 +08:00
|
|
|
set(DARWIN_osx_LINK_FLAGS
|
|
|
|
${DARWIN_COMMON_LINK_FLAGS}
|
2020-02-15 03:01:02 +08:00
|
|
|
${DARWIN_osx_MIN_VER_FLAG}=${SANITIZER_MIN_OSX_VERSION})
|
[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
|
|
|
|
2015-09-23 23:18:17 +08:00
|
|
|
if(DARWIN_osx_SYSROOT)
|
|
|
|
list(APPEND DARWIN_osx_CFLAGS -isysroot ${DARWIN_osx_SYSROOT})
|
2017-01-10 12:33:04 +08:00
|
|
|
list(APPEND DARWIN_osx_LINK_FLAGS -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}")
|
2019-01-23 02:59:25 +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(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}
|
2020-02-15 02:28:05 +08:00
|
|
|
${DARWIN_${platform}sim_SANITIZER_MIN_VER_FLAG}
|
2016-05-26 19:18:22 +08:00
|
|
|
-isysroot ${DARWIN_${platform}sim_SYSROOT})
|
2017-01-10 12:33:04 +08:00
|
|
|
set(DARWIN_${platform}sim_LINK_FLAGS
|
|
|
|
${DARWIN_COMMON_LINK_FLAGS}
|
2020-02-15 02:28:05 +08:00
|
|
|
${DARWIN_${platform}sim_SANITIZER_MIN_VER_FLAG}
|
2016-01-13 07:51:03 +08:00
|
|
|
-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-09-21 05:36:33 +08:00
|
|
|
if(DARWIN_${platform}sim_ARCHS)
|
2016-01-13 07:51:03 +08:00
|
|
|
list(APPEND SANITIZER_COMMON_SUPPORTED_OS ${platform}sim)
|
|
|
|
list(APPEND PROFILE_SUPPORTED_OS ${platform}sim)
|
2017-07-13 01:30:54 +08:00
|
|
|
list(APPEND TSAN_SUPPORTED_OS ${platform}sim)
|
2020-01-23 08:26:45 +08:00
|
|
|
list(APPEND FUZZER_SUPPORTED_OS ${platform}sim)
|
2021-10-21 01:37:32 +08:00
|
|
|
list(APPEND ORC_SUPPORTED_OS ${platform}sim)
|
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})
|
2017-01-10 12:33:04 +08:00
|
|
|
set(DARWIN_${platform}_LINK_FLAGS
|
|
|
|
${DARWIN_COMMON_LINK_FLAGS}
|
2016-01-13 07:51:03 +08:00
|
|
|
${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})
|
2018-06-29 00:43:43 +08:00
|
|
|
|
|
|
|
list_intersect(DARWIN_${platform}_TSAN_ARCHS DARWIN_${platform}_ARCHS ALL_TSAN_SUPPORTED_ARCH)
|
|
|
|
if(DARWIN_${platform}_TSAN_ARCHS)
|
|
|
|
list(APPEND TSAN_SUPPORTED_OS ${platform})
|
|
|
|
endif()
|
2020-01-23 08:26:45 +08:00
|
|
|
list(APPEND FUZZER_SUPPORTED_OS ${platform})
|
2021-10-21 01:37:32 +08:00
|
|
|
list(APPEND ORC_SUPPORTED_OS ${platform})
|
2016-01-13 07:51:03 +08:00
|
|
|
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()
|
|
|
|
|
2021-09-04 15:31:34 +08:00
|
|
|
# Explicitly disable unsupported Sanitizer configurations.
|
2020-02-15 03:43:35 +08:00
|
|
|
list(REMOVE_ITEM FUZZER_SUPPORTED_OS "watchos")
|
|
|
|
list(REMOVE_ITEM FUZZER_SUPPORTED_OS "watchossim")
|
|
|
|
|
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)
|
|
|
|
|
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)
|
[GWP-ASan] Initial build files, implementation of PRNG [1].
Summary:
See D60593 for further information.
This patch slices off the PRNG implementation and the initial build files for GWP-ASan.
Reviewers: vlad.tsyrklevich, morehouse, vitalybuka
Reviewed By: morehouse
Subscribers: srhines, kubamracek, mgorny, #sanitizers, llvm-commits, cryptoad, eugenis
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D61867
llvm-svn: 360710
2019-05-15 05:43:11 +08:00
|
|
|
list_intersect(GWP_ASAN_SUPPORTED_ARCH
|
|
|
|
ALL_GWP_ASAN_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)
|
2017-12-09 09:31:51 +08:00
|
|
|
list_intersect(HWASAN_SUPPORTED_ARCH
|
|
|
|
ALL_HWASAN_SUPPORTED_ARCH
|
|
|
|
SANITIZER_COMMON_SUPPORTED_ARCH)
|
2020-09-04 06:21:20 +08:00
|
|
|
list_intersect(MEMPROF_SUPPORTED_ARCH
|
|
|
|
ALL_MEMPROF_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)
|
[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)
|
[scudo] Initial standalone skeleton check-in
Summary:
This is the initial check-in for the Standalone version of Scudo.
The project is initially going to live in scudo/standalone then will
replace scudo. See http://lists.llvm.org/pipermail/llvm-dev/2019-January/129113.html
for details.
This initial CL is meant to lay out the project structure, of both
code & tests, providing a minimal amount of functionalities, namely
various definitions, some atomic helpers and an intrusive list.
(empty.cc is just here to have a compilation unit, but will go away
in the upcoming CLs).
Initial support is restricted to Linux i386 & x86_64 in make files
and will be extended once things land & work.
We will grow organically from here, adding functionalities in limited
amounts.
Reviewers: morehouse, eugenis, vitalybuka, kcc, mcgrathr, flowerhack
Reviewed By: morehouse, vitalybuka
Subscribers: srhines, mgorny, krytarowski, delcypher, jfb, #sanitizers, llvm-commits
Tags: #llvm, #sanitizers
Differential Revision: https://reviews.llvm.org/D57412
llvm-svn: 353055
2019-02-05 00:25:40 +08:00
|
|
|
list_intersect(SCUDO_STANDALONE_SUPPORTED_ARCH
|
|
|
|
ALL_SCUDO_STANDALONE_SUPPORTED_ARCH
|
|
|
|
SANITIZER_COMMON_SUPPORTED_ARCH)
|
2017-11-10 15:00:55 +08:00
|
|
|
list_intersect(FUZZER_SUPPORTED_ARCH
|
|
|
|
ALL_FUZZER_SUPPORTED_ARCH
|
2018-05-25 07:55:51 +08:00
|
|
|
SANITIZER_COMMON_SUPPORTED_ARCH)
|
2017-11-28 19:49:22 +08:00
|
|
|
list_intersect(XRAY_SUPPORTED_ARCH
|
|
|
|
ALL_XRAY_SUPPORTED_ARCH
|
|
|
|
SANITIZER_COMMON_SUPPORTED_ARCH)
|
2018-04-10 04:18:10 +08:00
|
|
|
list_intersect(SHADOWCALLSTACK_SUPPORTED_ARCH
|
|
|
|
ALL_SHADOWCALLSTACK_SUPPORTED_ARCH
|
|
|
|
SANITIZER_COMMON_SUPPORTED_ARCH)
|
2021-04-24 12:14:56 +08:00
|
|
|
list_intersect(ORC_SUPPORTED_ARCH
|
|
|
|
ALL_ORC_SUPPORTED_ARCH
|
|
|
|
SANITIZER_COMMON_SUPPORTED_ARCH)
|
2017-08-22 07:25:50 +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
|
|
|
else()
|
2019-05-01 02:13:22 +08:00
|
|
|
filter_available_targets(CRT_SUPPORTED_ARCH ${ALL_CRT_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
|
|
|
# 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})
|
2017-08-22 07:25:50 +08:00
|
|
|
filter_available_targets(FUZZER_SUPPORTED_ARCH ${ALL_FUZZER_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
|
|
|
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})
|
2017-12-09 09:31:51 +08:00
|
|
|
filter_available_targets(HWASAN_SUPPORTED_ARCH ${ALL_HWASAN_SUPPORTED_ARCH})
|
2020-09-04 06:21:20 +08:00
|
|
|
filter_available_targets(MEMPROF_SUPPORTED_ARCH ${ALL_MEMPROF_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
|
|
|
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})
|
[scudo] 32-bit and hardware agnostic support
Summary:
This update introduces i386 support for the Scudo Hardened Allocator, and
offers software alternatives for functions that used to require hardware
specific instruction sets. This should make porting to new architectures
easier.
Among the changes:
- The chunk header has been changed to accomodate the size limitations
encountered on 32-bit architectures. We now fit everything in 64-bit. This
was achieved by storing the amount of unused bytes in an allocation rather
than the size itself, as one can be deduced from the other with the help
of the GetActuallyAllocatedSize function. As it turns out, this header can
be used for both 64 and 32 bit, and as such we dropped the requirement for
the 128-bit compare and exchange instruction support (cmpxchg16b).
- Add 32-bit support for the checksum and the PRNG functions: if the SSE 4.2
instruction set is supported, use the 32-bit CRC32 instruction, and in the
XorShift128, use a 32-bit based state instead of 64-bit.
- Add software support for CRC32: if SSE 4.2 is not supported, fallback on a
software implementation.
- Modify tests that were not 32-bit compliant, and expand them to cover more
allocation and alignment sizes. The random shuffle test has been deactivated
for linux-i386 & linux-i686 as the 32-bit sanitizer allocator doesn't
currently randomize chunks.
Reviewers: alekseyshl, kcc
Subscribers: filcab, llvm-commits, tberghammer, danalbert, srhines, mgorny, modocache
Differential Revision: https://reviews.llvm.org/D26358
llvm-svn: 288255
2016-12-01 01:32:20 +08:00
|
|
|
filter_available_targets(SCUDO_SUPPORTED_ARCH ${ALL_SCUDO_SUPPORTED_ARCH})
|
2019-02-08 23:33:52 +08:00
|
|
|
filter_available_targets(SCUDO_STANDALONE_SUPPORTED_ARCH ${ALL_SCUDO_STANDALONE_SUPPORTED_ARCH})
|
2016-07-21 15:39:55 +08:00
|
|
|
filter_available_targets(XRAY_SUPPORTED_ARCH ${ALL_XRAY_SUPPORTED_ARCH})
|
2018-04-10 04:18:10 +08:00
|
|
|
filter_available_targets(SHADOWCALLSTACK_SUPPORTED_ARCH
|
|
|
|
${ALL_SHADOWCALLSTACK_SUPPORTED_ARCH})
|
[GWP-ASan] Initial build files, implementation of PRNG [1].
Summary:
See D60593 for further information.
This patch slices off the PRNG implementation and the initial build files for GWP-ASan.
Reviewers: vlad.tsyrklevich, morehouse, vitalybuka
Reviewed By: morehouse
Subscribers: srhines, kubamracek, mgorny, #sanitizers, llvm-commits, cryptoad, eugenis
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D61867
llvm-svn: 360710
2019-05-15 05:43:11 +08:00
|
|
|
filter_available_targets(GWP_ASAN_SUPPORTED_ARCH ${ALL_GWP_ASAN_SUPPORTED_ARCH})
|
2021-04-24 12:14:56 +08:00
|
|
|
filter_available_targets(ORC_SUPPORTED_ARCH ${ALL_ORC_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)
|
2021-09-14 20:59:28 +08:00
|
|
|
# Allow setting clang-cl's /winsysroot flag.
|
|
|
|
set(LLVM_WINSYSROOT "" CACHE STRING
|
|
|
|
"If set, argument to clang-cl's /winsysroot")
|
|
|
|
|
|
|
|
if (LLVM_WINSYSROOT)
|
|
|
|
set(MSVC_DIA_SDK_DIR "${LLVM_WINSYSROOT}/DIA SDK" CACHE PATH
|
|
|
|
"Path to the DIA SDK")
|
|
|
|
else()
|
|
|
|
set(MSVC_DIA_SDK_DIR "$ENV{VSINSTALLDIR}DIA SDK" CACHE PATH
|
|
|
|
"Path to the DIA SDK")
|
|
|
|
endif()
|
|
|
|
|
2016-01-23 04:26:10 +08:00
|
|
|
# See if the DIA SDK is available and usable.
|
|
|
|
if (IS_DIRECTORY ${MSVC_DIA_SDK_DIR})
|
|
|
|
set(CAN_SYMBOLIZE 1)
|
|
|
|
else()
|
|
|
|
set(CAN_SYMBOLIZE 0)
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
set(CAN_SYMBOLIZE 1)
|
|
|
|
endif()
|
|
|
|
|
2020-07-23 01:15:51 +08:00
|
|
|
find_program(GNU_LD_EXECUTABLE NAMES ${LLVM_DEFAULT_TARGET_TRIPLE}-ld.bfd ld.bfd DOC "GNU ld")
|
|
|
|
find_program(GOLD_EXECUTABLE NAMES ${LLVM_DEFAULT_TARGET_TRIPLE}-ld.gold ld.gold DOC "GNU gold")
|
2016-09-23 04:51:48 +08:00
|
|
|
|
2016-12-15 09:21:04 +08:00
|
|
|
if(COMPILER_RT_SUPPORTED_ARCH)
|
|
|
|
list(REMOVE_DUPLICATES COMPILER_RT_SUPPORTED_ARCH)
|
|
|
|
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
|
|
|
|
[GWP-ASan] Initial build files, implementation of PRNG [1].
Summary:
See D60593 for further information.
This patch slices off the PRNG implementation and the initial build files for GWP-ASan.
Reviewers: vlad.tsyrklevich, morehouse, vitalybuka
Reviewed By: morehouse
Subscribers: srhines, kubamracek, mgorny, #sanitizers, llvm-commits, cryptoad, eugenis
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D61867
llvm-svn: 360710
2019-05-15 05:43:11 +08:00
|
|
|
set(ALL_SANITIZERS asan;dfsan;msan;hwasan;tsan;safestack;cfi;scudo;ubsan_minimal;gwp_asan)
|
2017-08-26 09:13:33 +08:00
|
|
|
set(COMPILER_RT_SANITIZERS_TO_BUILD all CACHE STRING
|
2016-08-19 23:13:21 +08:00
|
|
|
"sanitizers to build if supported on the target (all;${ALL_SANITIZERS})")
|
|
|
|
list_replace(COMPILER_RT_SANITIZERS_TO_BUILD all "${ALL_SANITIZERS}")
|
|
|
|
|
2014-08-09 06:01:20 +08:00
|
|
|
if (SANITIZER_COMMON_SUPPORTED_ARCH AND NOT LLVM_USE_SANITIZER AND
|
2020-10-20 18:14:26 +08:00
|
|
|
(OS_NAME MATCHES "Android|Darwin|Linux|FreeBSD|NetBSD|Fuchsia|SunOS" OR
|
2018-09-26 14:53:01 +08:00
|
|
|
(OS_NAME MATCHES "Windows" AND NOT CYGWIN AND
|
|
|
|
(NOT MINGW OR CMAKE_CXX_COMPILER_ID MATCHES "Clang"))))
|
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()
|
|
|
|
|
2020-10-20 18:14:26 +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()
|
|
|
|
|
[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
llvm-svn: 321373
2017-12-23 02:04:20 +08:00
|
|
|
if (OS_NAME MATCHES "Linux|FreeBSD|Windows|NetBSD|SunOS")
|
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.
|
|
|
|
|
2020-07-10 16:24:58 +08:00
|
|
|
if (CRT_SUPPORTED_ARCH AND OS_NAME MATCHES "Linux" AND NOT LLVM_USE_SANITIZER)
|
2019-05-01 02:13:22 +08:00
|
|
|
set(COMPILER_RT_HAS_CRT TRUE)
|
|
|
|
else()
|
|
|
|
set(COMPILER_RT_HAS_CRT FALSE)
|
|
|
|
endif()
|
|
|
|
|
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
|
2020-11-05 06:09:08 +08:00
|
|
|
OS_NAME MATCHES "Android|Darwin|Linux|NetBSD|Fuchsia")
|
2015-12-10 08:40:58 +08:00
|
|
|
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
|
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
|
|
|
OS_NAME MATCHES "Linux|FreeBSD|NetBSD")
|
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()
|
|
|
|
|
2017-12-09 09:31:51 +08:00
|
|
|
if (COMPILER_RT_HAS_SANITIZER_COMMON AND HWASAN_SUPPORTED_ARCH AND
|
2021-06-03 02:19:56 +08:00
|
|
|
OS_NAME MATCHES "Linux|Android|Fuchsia")
|
2017-12-09 09:31:51 +08:00
|
|
|
set(COMPILER_RT_HAS_HWASAN TRUE)
|
|
|
|
else()
|
|
|
|
set(COMPILER_RT_HAS_HWASAN FALSE)
|
|
|
|
endif()
|
|
|
|
|
2020-09-04 06:21:20 +08:00
|
|
|
if (COMPILER_RT_HAS_SANITIZER_COMMON AND MEMPROF_SUPPORTED_ARCH AND
|
|
|
|
OS_NAME MATCHES "Linux")
|
|
|
|
set(COMPILER_RT_HAS_MEMPROF TRUE)
|
|
|
|
else()
|
|
|
|
set(COMPILER_RT_HAS_MEMPROF FALSE)
|
|
|
|
endif()
|
|
|
|
|
2016-09-17 14:31:23 +08:00
|
|
|
if (PROFILE_SUPPORTED_ARCH AND NOT LLVM_USE_SANITIZER AND
|
2020-11-04 00:44:18 +08:00
|
|
|
OS_NAME MATCHES "Darwin|Linux|FreeBSD|Windows|Android|Fuchsia|SunOS|NetBSD|AIX")
|
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
|
2017-11-28 01:54:26 +08:00
|
|
|
OS_NAME MATCHES "Darwin|Linux|FreeBSD|Android|NetBSD")
|
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()
|
|
|
|
|
2021-09-02 05:52:25 +08:00
|
|
|
if (OS_NAME MATCHES "Linux|FreeBSD|Windows|NetBSD|SunOS")
|
|
|
|
set(COMPILER_RT_TSAN_HAS_STATIC_RUNTIME TRUE)
|
|
|
|
else()
|
|
|
|
set(COMPILER_RT_TSAN_HAS_STATIC_RUNTIME FALSE)
|
|
|
|
endif()
|
|
|
|
|
2015-12-10 08:40:58 +08:00
|
|
|
if (COMPILER_RT_HAS_SANITIZER_COMMON AND UBSAN_SUPPORTED_ARCH AND
|
2020-10-20 18:14:26 +08:00
|
|
|
OS_NAME MATCHES "Darwin|Linux|FreeBSD|NetBSD|Windows|Android|Fuchsia|SunOS")
|
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()
|
|
|
|
|
2017-08-30 04:03:51 +08:00
|
|
|
if (COMPILER_RT_HAS_SANITIZER_COMMON AND UBSAN_SUPPORTED_ARCH AND
|
2020-10-20 18:14:26 +08:00
|
|
|
OS_NAME MATCHES "Linux|FreeBSD|NetBSD|Android|Darwin")
|
2017-08-30 04:03:51 +08:00
|
|
|
set(COMPILER_RT_HAS_UBSAN_MINIMAL TRUE)
|
|
|
|
else()
|
|
|
|
set(COMPILER_RT_HAS_UBSAN_MINIMAL FALSE)
|
|
|
|
endif()
|
|
|
|
|
2015-12-10 08:40:58 +08:00
|
|
|
if (COMPILER_RT_HAS_SANITIZER_COMMON AND SAFESTACK_SUPPORTED_ARCH AND
|
2019-01-21 07:03:10 +08:00
|
|
|
OS_NAME MATCHES "Linux|FreeBSD|NetBSD")
|
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
|
|
|
|
2017-10-10 01:07:47 +08:00
|
|
|
if (COMPILER_RT_HAS_SANITIZER_COMMON AND CFI_SUPPORTED_ARCH)
|
2015-12-16 07:00:33 +08:00
|
|
|
set(COMPILER_RT_HAS_CFI TRUE)
|
|
|
|
else()
|
|
|
|
set(COMPILER_RT_HAS_CFI FALSE)
|
|
|
|
endif()
|
2016-04-22 05:32:25 +08:00
|
|
|
|
2021-05-27 07:51:43 +08:00
|
|
|
#TODO(kostyak): add back Android & Fuchsia when the code settles a bit.
|
|
|
|
if (SCUDO_STANDALONE_SUPPORTED_ARCH AND OS_NAME MATCHES "Linux" AND
|
|
|
|
COMPILER_RT_HAS_AUXV)
|
[scudo] Initial standalone skeleton check-in
Summary:
This is the initial check-in for the Standalone version of Scudo.
The project is initially going to live in scudo/standalone then will
replace scudo. See http://lists.llvm.org/pipermail/llvm-dev/2019-January/129113.html
for details.
This initial CL is meant to lay out the project structure, of both
code & tests, providing a minimal amount of functionalities, namely
various definitions, some atomic helpers and an intrusive list.
(empty.cc is just here to have a compilation unit, but will go away
in the upcoming CLs).
Initial support is restricted to Linux i386 & x86_64 in make files
and will be extended once things land & work.
We will grow organically from here, adding functionalities in limited
amounts.
Reviewers: morehouse, eugenis, vitalybuka, kcc, mcgrathr, flowerhack
Reviewed By: morehouse, vitalybuka
Subscribers: srhines, mgorny, krytarowski, delcypher, jfb, #sanitizers, llvm-commits
Tags: #llvm, #sanitizers
Differential Revision: https://reviews.llvm.org/D57412
llvm-svn: 353055
2019-02-05 00:25:40 +08:00
|
|
|
set(COMPILER_RT_HAS_SCUDO_STANDALONE TRUE)
|
|
|
|
else()
|
|
|
|
set(COMPILER_RT_HAS_SCUDO_STANDALONE 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
|
2021-08-19 09:22:28 +08:00
|
|
|
OS_NAME MATCHES "Linux|Fuchsia")
|
[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(COMPILER_RT_HAS_SCUDO TRUE)
|
|
|
|
else()
|
|
|
|
set(COMPILER_RT_HAS_SCUDO FALSE)
|
|
|
|
endif()
|
|
|
|
|
2016-07-21 15:39:55 +08:00
|
|
|
if (COMPILER_RT_HAS_SANITIZER_COMMON AND XRAY_SUPPORTED_ARCH AND
|
2020-10-20 18:14:26 +08:00
|
|
|
OS_NAME MATCHES "Darwin|Linux|FreeBSD|NetBSD|Fuchsia")
|
2016-07-21 15:39:55 +08:00
|
|
|
set(COMPILER_RT_HAS_XRAY TRUE)
|
|
|
|
else()
|
|
|
|
set(COMPILER_RT_HAS_XRAY FALSE)
|
|
|
|
endif()
|
2017-08-22 07:25:50 +08:00
|
|
|
|
2021-04-24 12:14:56 +08:00
|
|
|
if (ORC_SUPPORTED_ARCH)
|
|
|
|
set(COMPILER_RT_HAS_ORC TRUE)
|
|
|
|
else()
|
|
|
|
set(COMPILER_RT_HAS_ORC FALSE)
|
|
|
|
endif()
|
|
|
|
|
2017-08-22 07:25:50 +08:00
|
|
|
if (COMPILER_RT_HAS_SANITIZER_COMMON AND FUZZER_SUPPORTED_ARCH AND
|
2020-10-20 18:14:26 +08:00
|
|
|
OS_NAME MATCHES "Android|Darwin|Linux|NetBSD|FreeBSD|Fuchsia|Windows")
|
2017-08-22 07:25:50 +08:00
|
|
|
set(COMPILER_RT_HAS_FUZZER TRUE)
|
|
|
|
else()
|
|
|
|
set(COMPILER_RT_HAS_FUZZER FALSE)
|
|
|
|
endif()
|
2018-04-10 04:18:10 +08:00
|
|
|
|
|
|
|
if (COMPILER_RT_HAS_SANITIZER_COMMON AND SHADOWCALLSTACK_SUPPORTED_ARCH AND
|
|
|
|
OS_NAME MATCHES "Linux|Android")
|
|
|
|
set(COMPILER_RT_HAS_SHADOWCALLSTACK TRUE)
|
|
|
|
else()
|
|
|
|
set(COMPILER_RT_HAS_SHADOWCALLSTACK FALSE)
|
|
|
|
endif()
|
[GWP-ASan] Initial build files, implementation of PRNG [1].
Summary:
See D60593 for further information.
This patch slices off the PRNG implementation and the initial build files for GWP-ASan.
Reviewers: vlad.tsyrklevich, morehouse, vitalybuka
Reviewed By: morehouse
Subscribers: srhines, kubamracek, mgorny, #sanitizers, llvm-commits, cryptoad, eugenis
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D61867
llvm-svn: 360710
2019-05-15 05:43:11 +08:00
|
|
|
|
|
|
|
# Note: Fuchsia and Windows are not currently supported by GWP-ASan. Support
|
|
|
|
# is planned for these platforms. Darwin is also not supported due to TLS
|
|
|
|
# calling malloc on first use.
|
2019-06-18 06:35:32 +08:00
|
|
|
# TODO(hctim): Enable this on Android again. Looks like it's causing a SIGSEGV
|
|
|
|
# for Scudo and GWP-ASan, further testing needed.
|
2021-07-28 01:44:14 +08:00
|
|
|
if (GWP_ASAN_SUPPORTED_ARCH AND COMPILER_RT_BUILD_GWP_ASAN AND
|
2019-06-18 06:35:32 +08:00
|
|
|
OS_NAME MATCHES "Linux")
|
[GWP-ASan] Initial build files, implementation of PRNG [1].
Summary:
See D60593 for further information.
This patch slices off the PRNG implementation and the initial build files for GWP-ASan.
Reviewers: vlad.tsyrklevich, morehouse, vitalybuka
Reviewed By: morehouse
Subscribers: srhines, kubamracek, mgorny, #sanitizers, llvm-commits, cryptoad, eugenis
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D61867
llvm-svn: 360710
2019-05-15 05:43:11 +08:00
|
|
|
set(COMPILER_RT_HAS_GWP_ASAN TRUE)
|
|
|
|
else()
|
|
|
|
set(COMPILER_RT_HAS_GWP_ASAN FALSE)
|
|
|
|
endif()
|
|
|
|
pythonize_bool(COMPILER_RT_HAS_GWP_ASAN)
|