[PATCH] D84947: Add libFuzzer shared object build output

Ian Eldred Pudney via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 5 12:29:35 PDT 2020


IanPudney added inline comments.


================
Comment at: compiler-rt/lib/fuzzer/CMakeLists.txt:192
+  set(LIBFUZZER_SHARED_LINK_LIBS ${SANITIZER_COMMON_LINK_LIBS})
+  list(APPEND LIBFUZZER_SHARED_LINK_LIBS "-lstdc++")
+  list(APPEND LIBFUZZER_SHARED_LINK_LIBS "-lm")
----------------
lebedev.ri wrote:
> morehouse wrote:
> > jfb wrote:
> > > This is broken on non-Linux and non-Fuchsia architectures which don't have libstdc++, for example Darwin. Can you please fix or revert? 
> > Would it be sufficient to add the following?
> > ```
> > if (DARWIN)
> >   list(APPEND LIBFUZZER_SHARED_LINK_LIBS "-lc++")
> > else()
> >   list(APPEND LIBFUZZER_SHARED_LINK_LIBS "-lstdc++")
> > endif()
> > ```
> > Or are there more platforms that are missing libstdc++?
> Why is this particular line hardcoding some particular C++ STD implementation in the first place?
> Ignoring distro defaults, one can always pass `-stdlib=libc++` to clang.
Passing -stdlib=libc++ into the CFLAGS of the rule doesn't solve the problem. The .so links, but at runtime it complains about missing symbols like _ZTVN10__cxxabiv120__si_class_type_infoE.


================
Comment at: compiler-rt/lib/fuzzer/CMakeLists.txt:192
+  set(LIBFUZZER_SHARED_LINK_LIBS ${SANITIZER_COMMON_LINK_LIBS})
+  list(APPEND LIBFUZZER_SHARED_LINK_LIBS "-lstdc++")
+  list(APPEND LIBFUZZER_SHARED_LINK_LIBS "-lm")
----------------
IanPudney wrote:
> lebedev.ri wrote:
> > morehouse wrote:
> > > jfb wrote:
> > > > This is broken on non-Linux and non-Fuchsia architectures which don't have libstdc++, for example Darwin. Can you please fix or revert? 
> > > Would it be sufficient to add the following?
> > > ```
> > > if (DARWIN)
> > >   list(APPEND LIBFUZZER_SHARED_LINK_LIBS "-lc++")
> > > else()
> > >   list(APPEND LIBFUZZER_SHARED_LINK_LIBS "-lstdc++")
> > > endif()
> > > ```
> > > Or are there more platforms that are missing libstdc++?
> > Why is this particular line hardcoding some particular C++ STD implementation in the first place?
> > Ignoring distro defaults, one can always pass `-stdlib=libc++` to clang.
> Passing -stdlib=libc++ into the CFLAGS of the rule doesn't solve the problem. The .so links, but at runtime it complains about missing symbols like _ZTVN10__cxxabiv120__si_class_type_infoE.
Added this in https://reviews.llvm.org/D85339. However, I don't have a Darwin machine to test with.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84947/new/

https://reviews.llvm.org/D84947



More information about the llvm-commits mailing list