[PATCH] D37631: [libFuzzer] Support using libc++

Vitaly Buka via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 7 00:21:26 PST 2017


vitalybuka added a comment.

In https://reviews.llvm.org/D37631#947752, @phosek wrote:

> Turned out the problem was an incompatibility between libc++abi (which libc++ assumes as the default C++ ABI) and libstdc++ (which is what is being used when linking against libstdc++). Setting `-DLIBCXX_CXX_ABI=none` seems to be the solution. I'm still trying to figure what's the best way to tests against libc++, simply linking them isn't enough because `libc++.so.1` is not in the default dynamic linker search path.


I assume because of this the patch is not finished yet?

If I apply the patch, check-fuzzer does not work for me. I see output like following and I don't see test command-line has path to libc++

  FAIL: LLVMFuzzer :: fuzzer-customcrossover.test (19 of 147)
  ******************** TEST 'LLVMFuzzer :: fuzzer-customcrossover.test' FAILED ********************
  Script:
  --
  ./bin/clang -std=c++11 -lstdc++ -gline-tables-only  -fsanitize=address,fuzzer -Icompiler-rt/lib/fuzzer compiler-rt/test/fuzzer/CustomCrossOverTest.cpp -o projects/compiler-rt/test/fuzzer/Output/fuzzer-customcrossover.test.tmp-CustomCrossOverTest
  not projects/compiler-rt/test/fuzzer/Output/fuzzer-customcrossover.test.tmp-CustomCrossOverTest -seed=1 -runs=1000000                2>&1 | FileCheck compiler-rt/test/fuzzer/fuzzer-customcrossover.test --check-prefix=CHECK_CO
  projects/compiler-rt/test/fuzzer/Output/fuzzer-customcrossover.test.tmp-CustomCrossOverTest -seed=1 -runs=1000000 -cross_over=0 2>&1 | FileCheck compiler-rt/test/fuzzer/fuzzer-customcrossover.test --check-prefix=CHECK_NO_CO
  --
  Exit Code: 1
  
  Command Output (stderr):
  --
  compiler-rt/test/fuzzer/fuzzer-customcrossover.test:8:11: error: expected string not found in input
  CHECK_CO: BINGO
            ^
  <stdin>:9:30: note: scanning from here
  In LLVMFuzzerCustomCrossover uncaught_exceptions not yet implemented
                               ^
  <stdin>:17:142: note: possible intended match here
   #6 0x45a425 in std::uncaught_exceptions() (projects/compiler-rt/test/fuzzer/Output/fuzzer-customcrossover.test.tmp-CustomCrossOverTest+0x45a425)
                                                                                                                                              ^



================
Comment at: lib/fuzzer/CMakeLists.txt:93
+    target_compile_options(RTfuzzer_main.${arch} PRIVATE
+      -isystem ${CMAKE_CURRENT_BINARY_DIR}/libcxx_fuzzer_${arch}/include/c++/v1
+    )
----------------
it would be nice if add_custom_libcxx set some variable with include dir
but it should be done in separate patch


================
Comment at: lib/fuzzer/CMakeLists.txt:97
+    file(MAKE_DIRECTORY ${cxx_${arch}_merge_dir})
+    add_custom_command(TARGET clang_rt.fuzzer-${arch} POST_BUILD
+    COMMAND
----------------
alignment of arguments is very unusual. could you make it more consistent with existing code?


================
Comment at: test/fuzzer/CMakeLists.txt:22
 
-foreach(arch ${FUZZER_SUPPORTED_ARCH})
-  set(LIBFUZZER_TEST_COMPILER ${COMPILER_RT_TEST_COMPILER})
-  get_test_cc_for_arch(${arch} LIBFUZZER_TEST_COMPILER LIBFUZZER_TEST_FLAGS)
-
-  string(TOUPPER ${arch} ARCH_UPPER_CASE)
-  set(CONFIG_NAME ${ARCH_UPPER_CASE}${OS_NAME}Config)
-
-  # LIT-based libFuzzer tests.
-  configure_lit_site_cfg(
-    ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
-    ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg
-    )
-  list(APPEND LIBFUZZER_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME})
-
+foreach(stdlib IN ITEMS stdlibc++)
+  foreach(arch ${FUZZER_SUPPORTED_ARCH})
----------------
could you please remove loop until we have more than one time?


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D37631





More information about the llvm-commits mailing list