[PATCH] D44532: Add option to disable linking of libcxx into fuzzer
Pirama Arumuga Nainar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 15 12:33:10 PDT 2018
pirama created this revision.
pirama added reviewers: srhines, chh, phosek.
Herald added subscribers: Sanitizers, delcypher, mgorny.
Herald added a reviewer: EricWF.
Herald added a reviewer: EricWF.
The ability to partially link libcxx into fuzzer does not work for cross
compilations. CMAKE_EXE_LINKER_FLAGS, etc are not passed to the custom CMake
invocation and cross-compiling libcxx without a libcxxabi, as is done here, has
further issues as well.
Add an option to disable linking of libcxx into fuzzer. The default for this
option is to link libcxx.
Repository:
rCRT Compiler Runtime
https://reviews.llvm.org/D44532
Files:
CMakeLists.txt
lib/fuzzer/CMakeLists.txt
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 FUZZER_LINK_LIBCXX)
list(APPEND LIBFUZZER_CFLAGS -nostdinc++ -D_LIBCPP_ABI_VERSION=Fuzzer)
# Remove -stdlib= which is unused when passing -nostdinc++.
string(REGEX REPLACE "-stdlib=[a-zA-Z+]*" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
@@ -81,7 +81,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 FUZZER_LINK_LIBCXX)
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})
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -38,6 +38,8 @@
mark_as_advanced(COMPILER_RT_BUILD_PROFILE)
option(COMPILER_RT_BUILD_XRAY_NO_PREINIT "Build xray with no preinit patching" OFF)
mark_as_advanced(COMPILER_RT_BUILD_XRAY_NO_PREINIT)
+option(FUZZER_LINK_LIBCXX "Link a copy of libcxx into libfuzzer" ON)
+mark_as_advanced(FUZZER_LINK_LIBCXX)
set(COMPILER_RT_ASAN_SHADOW_SCALE ""
CACHE STRING "Override the shadow scale to be used in ASan runtime")
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44532.138602.patch
Type: text/x-patch
Size: 1599 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180315/bd10de02/attachment.bin>
More information about the llvm-commits
mailing list