[PATCH] D42286: [libfuzzer] Don't try to build tests with the just built compiler unless it's usable.

Don Hinton via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 19 01:04:42 PST 2018


hintonda created this revision.
hintonda added a reviewer: phosek.
Herald added subscribers: Sanitizers, mgorny.

Add test for COMPILER_RT_CAN_EXECUTE_TESTS to prevent using
the just built compiler when it's unusable, e.g., when cross
compiling.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D42286

Files:
  lib/fuzzer/CMakeLists.txt
  lib/fuzzer/tests/CMakeLists.txt


Index: lib/fuzzer/tests/CMakeLists.txt
===================================================================
--- lib/fuzzer/tests/CMakeLists.txt
+++ lib/fuzzer/tests/CMakeLists.txt
@@ -18,7 +18,7 @@
   list(APPEND LIBFUZZER_UNITTEST_LINK_FLAGS -lstdc++ -lpthread)
 endif()
 
-if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" AND COMPILER_RT_LIBCXX_PATH)
+if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" AND COMPILER_RT_LIBCXX_PATH AND COMPILER_RT_CAN_EXECUTE_TESTS)
   list(APPEND LIBFUZZER_UNITTEST_CFLAGS -nostdinc++ -D_LIBCPP_ABI_VERSION=__Fuzzer)
 endif()
 
@@ -37,7 +37,7 @@
     ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
     FOLDER "Compiler-RT Runtime tests")
 
-  if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" AND COMPILER_RT_LIBCXX_PATH)
+  if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" AND COMPILER_RT_LIBCXX_PATH AND COMPILER_RT_CAN_EXECUTE_TESTS)
     set(LIBFUZZER_TEST_RUNTIME_DEPS libcxx_fuzzer_${arch})
     set(LIBFUZZER_TEST_RUNTIME_CFLAGS -isystem ${LIBCXX_${arch}_PREFIX}/include/c++/v1)
     set(LIBFUZZER_TEST_RUNTIME_LINK_FLAGS ${LIBCXX_${arch}_PREFIX}/lib/libc++.a)
Index: lib/fuzzer/CMakeLists.txt
===================================================================
--- lib/fuzzer/CMakeLists.txt
+++ lib/fuzzer/CMakeLists.txt
@@ -33,7 +33,7 @@
 
 set(LIBFUZZER_CFLAGS ${SANITIZER_COMMON_CFLAGS})
 
-if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" AND COMPILER_RT_LIBCXX_PATH)
+if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" AND COMPILER_RT_LIBCXX_PATH AND COMPILER_RT_CAN_EXECUTE_TESTS)
   list(APPEND LIBFUZZER_CFLAGS -nostdinc++ -D_LIBCPP_ABI_VERSION=__Fuzzer)
 endif()
 
@@ -79,7 +79,7 @@
   CFLAGS ${LIBFUZZER_CFLAGS}
   PARENT_TARGET fuzzer)
 
-if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" AND COMPILER_RT_LIBCXX_PATH)
+if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" AND COMPILER_RT_LIBCXX_PATH AND COMPILER_RT_CAN_EXECUTE_TESTS)
   macro(partially_link_libcxx name dir arch)
     set(cxx_${arch}_merge_dir "${CMAKE_CURRENT_BINARY_DIR}/cxx_${arch}_merge.dir")
     file(MAKE_DIRECTORY ${cxx_${arch}_merge_dir})


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42286.130567.patch
Type: text/x-patch
Size: 2019 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180119/24b4e91e/attachment.bin>


More information about the llvm-commits mailing list