summaryrefslogtreecommitdiff
path: root/lib/fuzzer
diff options
context:
space:
mode:
authorPetr Hosek <phosek@chromium.org>2018-06-18 08:01:57 +0000
committerPetr Hosek <phosek@chromium.org>2018-06-18 08:01:57 +0000
commitc2e13f24f358376076db5b8c0da923bfabcdc836 (patch)
tree30107d08e2611cfb30727f693c10a34ac58d8d08 /lib/fuzzer
parent3a31d0b02b843db568b5fdee3412dc0584d5e46f (diff)
[Fuzzer] Set an explicit libc++ dependency when needed
On targets that don't link internal libc++ (Fuchsia and Linux) but use libc++ as their C++ library and libFuzzer is being built using the just built compiler together with libc++ as part of runtimes, we need an explicit dependency from libFuzzer object library to libc++ to make sure the headers are available by the time we start building libFuzzer. Differential Revision: https://reviews.llvm.org/D48261 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@334928 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/fuzzer')
-rw-r--r--lib/fuzzer/CMakeLists.txt8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/fuzzer/CMakeLists.txt b/lib/fuzzer/CMakeLists.txt
index 1507608ea..cb511b09b 100644
--- a/lib/fuzzer/CMakeLists.txt
+++ b/lib/fuzzer/CMakeLists.txt
@@ -38,6 +38,8 @@ if(OS_NAME MATCHES "Linux|Fuchsia" AND COMPILER_RT_LIBCXX_PATH)
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})
+elseif(CLANG_DEFAULT_CXX_STDLIB STREQUAL "libc++" AND (TARGET cxx OR HAVE_LIBCXX))
+ set(LIBFUZZER_DEPS cxx)
endif()
append_list_if(COMPILER_RT_HAS_OMIT_FRAME_POINTER_FLAG -fno-omit-frame-pointer LIBFUZZER_CFLAGS)
@@ -56,13 +58,15 @@ add_compiler_rt_object_libraries(RTfuzzer
OS ${FUZZER_SUPPORTED_OS}
ARCHS ${FUZZER_SUPPORTED_ARCH}
SOURCES ${LIBFUZZER_SOURCES}
- CFLAGS ${LIBFUZZER_CFLAGS})
+ CFLAGS ${LIBFUZZER_CFLAGS}
+ DEPS ${LIBFUZZER_DEPS})
add_compiler_rt_object_libraries(RTfuzzer_main
OS ${FUZZER_SUPPORTED_OS}
ARCHS ${FUZZER_SUPPORTED_ARCH}
SOURCES FuzzerMain.cpp
- CFLAGS ${LIBFUZZER_CFLAGS})
+ CFLAGS ${LIBFUZZER_CFLAGS}
+ DEPS ${LIBFUZZER_DEPS})
add_compiler_rt_runtime(clang_rt.fuzzer
STATIC