[compiler-rt] b0c50ef - Revert "Add libFuzzer shared object build output"

Matt Morehouse via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 5 12:12:33 PDT 2020


Author: Matt Morehouse
Date: 2020-08-05T12:11:24-07:00
New Revision: b0c50ef759d368b33731d0261cae78117c3accdd

URL: https://github.com/llvm/llvm-project/commit/b0c50ef759d368b33731d0261cae78117c3accdd
DIFF: https://github.com/llvm/llvm-project/commit/b0c50ef759d368b33731d0261cae78117c3accdd.diff

LOG: Revert "Add libFuzzer shared object build output"

This reverts commit 98d91aecb26a51225242332e73ed454c0f6cac5e since it
breaks on platforms without libstdc++.

Added: 
    

Modified: 
    compiler-rt/lib/fuzzer/CMakeLists.txt
    llvm/docs/LibFuzzer.rst

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/fuzzer/CMakeLists.txt b/compiler-rt/lib/fuzzer/CMakeLists.txt
index 6b4fc9878508..b98c27145687 100644
--- a/compiler-rt/lib/fuzzer/CMakeLists.txt
+++ b/compiler-rt/lib/fuzzer/CMakeLists.txt
@@ -170,41 +170,7 @@ if(OS_NAME MATCHES "Linux|Fuchsia" AND
     partially_link_libcxx(fuzzer_no_main ${LIBCXX_${arch}_PREFIX} ${arch})
     partially_link_libcxx(fuzzer_interceptors ${LIBCXX_${arch}_PREFIX} ${arch})
     partially_link_libcxx(fuzzer ${LIBCXX_${arch}_PREFIX} ${arch})
-    if(NOT ${arch} MATCHES "i386") # i386 unsupported for .so version.
-      add_custom_command(
-        OUTPUT clang_rt.fuzzer_no_main-${arch}.so
-        DEPENDS clang_rt.fuzzer_no_main-${arch}
-       COMMAND ${CMAKE_CXX_COMPILER} ${EMULATION_ARGUMENT} -Wl,--whole-archive -rdynamic "$<TARGET_LINKER_FILE:clang_rt.fuzzer_no_main-${arch}>" -Wl,--no-whole-archive -shared -fPIC -o "$<TARGET_FILE_DIR:clang_rt.fuzzer_no_main-${arch}>/libclang_rt.fuzzer_no_main-${arch}.so"
-        COMMENT "Building clang_rt.fuzzer_no_main-${arch}.so"
-      )
-      get_compiler_rt_install_dir(${arch} install_dir)
-      install(FILES "$<TARGET_FILE_DIR:clang_rt.fuzzer_no_main-${arch}>/libclang_rt.fuzzer_no_main-${arch}.so"
-        DESTINATION ${install_dir}
-      )
-      add_custom_target(
-        clang_rt.fuzzer_no_main-${arch}-so ALL
-        DEPENDS clang_rt.fuzzer_no_main-${arch}.so
-      )
-    endif()
   endforeach()
-else()
-  set(LIBFUZZER_SHARED_LINK_LIBS ${SANITIZER_COMMON_LINK_LIBS})
-  list(APPEND LIBFUZZER_SHARED_LINK_LIBS "-lstdc++")
-  list(APPEND LIBFUZZER_SHARED_LINK_LIBS "-lm")
-  if(NOT ANDROID)
-    list(APPEND LIBFUZZER_SHARED_LINK_LIBS "-lpthread")
-  endif()
-
-  # If we aren't statically linking libc++ into the fuzzer, we can build the shared object directly
-  add_compiler_rt_runtime(clang_rt.fuzzer_no_main
-    SHARED
-    OS ${FUZZER_SUPPORTED_OS}
-    ARCHS ${FUZZER_SUPPORTED_ARCH}
-    OBJECT_LIBS RTfuzzer
-    CFLAGS ${LIBFUZZER_CFLAGS}
-    LINK_FLAGS ${SANITIZER_COMMON_LINK_FLAGS}
-    LINK_LIBS ${LIBFUZZER_SHARED_LINK_LIBS}
-    PARENT_TARGET fuzzer)
 endif()
 
 if(COMPILER_RT_INCLUDE_TESTS)

diff  --git a/llvm/docs/LibFuzzer.rst b/llvm/docs/LibFuzzer.rst
index c498a9a7078a..70a3f029c6f3 100644
--- a/llvm/docs/LibFuzzer.rst
+++ b/llvm/docs/LibFuzzer.rst
@@ -620,18 +620,13 @@ really need to access ``argv``/``argc``.
 Using libFuzzer as a library
 ----------------------------
 If the code being fuzzed must provide its own `main`, it's possible to
-invoke libFuzzer as a library. Static linking is available on all platforms
-supported by libFuzzer; however, dynamic linking is not available on
-certain platforms (notably 32-bit x86 Linux).
-
-When using libFuzzer as a library, be sure to pass ``-fsanitize=fuzzer-no-link``
+invoke libFuzzer as a library. Be sure to pass ``-fsanitize=fuzzer-no-link``
 during compilation, and link your binary against the no-main version of
 libFuzzer. On Linux installations, this is typically located at:
 
 .. code-block:: bash
 
   /usr/lib/<llvm-version>/lib/clang/<clang-version>/lib/linux/libclang_rt.fuzzer_no_main-<architecture>.a
-  /usr/lib/<llvm-version>/lib/clang/<clang-version>/lib/linux/libclang_rt.fuzzer_no_main-<architecture>.so
 
 If building libFuzzer from source, this is located at the following path
 in the build output directory:
@@ -639,7 +634,6 @@ in the build output directory:
 .. code-block:: bash
 
   lib/linux/libclang_rt.fuzzer_no_main-<architecture>.a
-  lib/linux/libclang_rt.fuzzer_no_main-<architecture>.so
 
 From here, the code can do whatever setup it requires, and when it's ready
 to start fuzzing, it can call `LLVMFuzzerRunDriver`, passing in the program
@@ -651,6 +645,8 @@ arguments and a callback. This callback is invoked just like
   extern "C" int LLVMFuzzerRunDriver(int *argc, char ***argv,
                     int (*UserCb)(const uint8_t *Data, size_t Size));
 
+
+
 Leaks
 -----
 


        


More information about the llvm-commits mailing list