[PATCH] D45662: Fuzzer, add libcxx for OpenBSD

Dean Michael Berris via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 16 23:53:29 PDT 2018


dberris added inline comments.


================
Comment at: lib/Driver/ToolChains/OpenBSD.cpp:189
       if (getToolChain().ShouldLinkCXXStdlib(Args))
-        getToolChain().AddCXXStdlibLibArgs(Args, CmdArgs);
+        ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);
       if (Args.hasArg(options::OPT_pg))
----------------
Do you actually need this change? Why isn't `getToolChain().AddCXXStdlibLibArgs(...)` not sufficient here?


================
Comment at: lib/Driver/ToolChains/OpenBSD.cpp:197-199
+      if (getToolChain().getSanitizerArgs().needsFuzzer() &&
+        !Args.hasArg(options::OPT_shared))
+        CmdArgs.push_back(Args.hasArg(options::OPT_pg) ? "-lc++_p" : "-lc++");
----------------
Doesn't the common args implementation already handle this case? What am I missing?


================
Comment at: lib/Driver/ToolChains/OpenBSD.cpp:265-269
+void OpenBSD::AddCXXStdlibLibArgs(const ArgList &Args,
+                                  ArgStringList &CmdArgs) const {
+  bool Profiling = Args.hasArg(options::OPT_pg);
+  CmdArgs.push_back(Profiling ? "-lstdc++_p" : "-lstdc++");
+}
----------------
Almost there -- but I think you want to look at the implementation of something like the FreeBSD driver which does a suitably complete definition, which supports either libstdc++ or libc++.

That way you don't need the other change specific to when you need the sanitizer deps, and rely on the default implementation for LibFuzzer in CommonArgs. No?

Am looking at https://clang.llvm.org/doxygen/FreeBSD_8cpp_source.html#l00345 for reference.


https://reviews.llvm.org/D45662





More information about the cfe-commits mailing list