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

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 13 16:34:56 PST 2018


phosek added inline comments.


================
Comment at: test/fuzzer/lit.cfg:57
+  else:
+    link_cmd = '-lc++' if 'darwin' in config.target_triple else '-lstdc++'
   std_cmd = '-std=c++11' if is_cpp else ''
----------------
morehouse wrote:
> phosek wrote:
> > morehouse wrote:
> > > What is the difference between `-stdlib=libc++` and `-lc++`?  Why does the original code use `-lc++` instead?
> > `-stdlib=libc++` is handled by the driver which sets up the header include paths (i.e. the C++ library header path which is different for lib++ and stdlibc++) appropriately and adds all necessary libraries which could be more than just `-lc++`, e.g. `-lc++abi` or `-lunwind`. I don't know why the original code is setting the library explicitly since this should normally be handled by the driver appropriately for each host.
> Now we are specifying both `-stdlib=libc++` and `-lc++`.  Why is `-lc++` necessary now?
Turned the problem is that we're always C compiler even when building C++ code so `-stdlib=libc++` isn't sufficient. I've updated the script to also add `--driver-mode=g++` in C++ mode so this is no longer needed.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D37631





More information about the llvm-commits mailing list