[PATCH] D48061: [CMake] Provide direct support for building sanitized runtimes
Petr Hosek via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 26 20:40:35 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL335704: [CMake] Provide direct support for building sanitized runtimes (authored by phosek, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D48061?vs=150883&id=152999#toc
Repository:
rL LLVM
https://reviews.llvm.org/D48061
Files:
cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
llvm/trunk/runtimes/CMakeLists.txt
Index: cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
===================================================================
--- cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
+++ cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
@@ -46,7 +46,9 @@
set(BUILTINS_${target}-fuchsia_CMAKE_SYSROOT ${FUCHSIA_${target}_SYSROOT} CACHE PATH "")
endforeach()
-set(LLVM_RUNTIME_TARGETS "default;x86_64-fuchsia;aarch64-fuchsia;x86_64-fuchsia-asan:x86_64-fuchsia;aarch64-fuchsia-asan:aarch64-fuchsia" CACHE STRING "")
+set(LLVM_RUNTIME_TARGETS "default;x86_64-fuchsia;aarch64-fuchsia" CACHE STRING "")
+set(LLVM_RUNTIME_SANITIZERS "Address" CACHE STRING "")
+set(LLVM_RUNTIME_SANITIZER_Address_TARGETS "x86_64-fuchsia;aarch64-fuchsia" CACHE STRING "")
# Set the default target runtimes options.
if(NOT APPLE)
@@ -81,11 +83,6 @@
set(RUNTIMES_${target}-fuchsia_LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "")
set(RUNTIMES_${target}-fuchsia_LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
set(RUNTIMES_${target}-fuchsia_SANITIZER_USE_COMPILER_RT ON CACHE BOOL "")
-
- set(RUNTIMES_${target}-fuchsia-asan_LLVM_USE_SANITIZER Address CACHE STRING "")
- set(RUNTIMES_${target}-fuchsia-asan_LLVM_RUNTIMES_PREFIX "${target}-fuchsia/" CACHE STRING "")
- set(RUNTIMES_${target}-fuchsia-asan_LLVM_RUNTIMES_LIBDIR_SUFFIX "/asan" CACHE STRING "")
- set(RUNTIMES_${target}-fuchsia-asan_LIBCXX_INSTALL_HEADERS OFF CACHE BOOL "")
endforeach()
# Setup toolchain.
Index: llvm/trunk/runtimes/CMakeLists.txt
===================================================================
--- llvm/trunk/runtimes/CMakeLists.txt
+++ llvm/trunk/runtimes/CMakeLists.txt
@@ -507,15 +507,7 @@
endif()
foreach(name ${LLVM_RUNTIME_TARGETS})
- set(target ${name})
- string(REPLACE ":" ";" target_list ${target})
- list(GET target_list 0 name)
- list(LENGTH target_list target_list_len)
- if(${target_list_len} GREATER 1)
- list(GET target_list 1 target)
- endif()
-
- runtime_register_target(${name} ${target}
+ runtime_register_target(${name} ${name}
DEPS ${deps}
)
@@ -528,6 +520,32 @@
add_dependencies(runtimes-test-depends runtimes-test-depends-${name})
endif()
endforeach()
+
+ foreach(sanitizer ${LLVM_RUNTIME_SANITIZERS})
+ if (sanitizer STREQUAL "Address")
+ set(sanitizer_name "asan")
+ elseif (sanitizer STREQUAL "Memory")
+ set(sanitizer_name "msan")
+ elseif (sanitizer STREQUAL "Thread")
+ set(sanitizer_name "tsan")
+ elseif (sanitizer STREQUAL "Undefined")
+ set(sanitizer_name "ubsan")
+ else()
+ message(FATAL_ERROR "Unsupported value of LLVM_RUNTIME_TARGET_SANITIZERS: ${sanitizers}")
+ endif()
+ foreach(name ${LLVM_RUNTIME_SANITIZER_${sanitizer}_TARGETS})
+ runtime_register_target(${name}-${sanitizer_name} ${name}
+ DEPS runtimes-${name}
+ CMAKE_ARGS -DLLVM_USE_SANITIZER=${sanitizer}
+ -DLLVM_RUNTIMES_PREFIX=${name}/
+ -DLLVM_RUNTIMES_LIBDIR_SUFFIX=/${sanitizer_name}
+ )
+ add_dependencies(runtimes runtimes-${name}-${sanitizer_name})
+ add_dependencies(runtimes-configure runtimes-${name}-${sanitizer_name}-configure)
+ add_dependencies(install-runtimes install-runtimes-${name}-${sanitizer_name})
+ add_dependencies(install-runtimes-stripped install-runtimes-${name}-${sanitizer_name}-stripped)
+ endforeach()
+ endforeach()
endif()
# TODO: This is a hack needed because the libcxx headers are copied into the
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48061.152999.patch
Type: text/x-patch
Size: 3663 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180627/4c1ad068/attachment.bin>
More information about the llvm-commits
mailing list