[PATCH] D45662: OpenBSD add C++ runtime in a driver's standpoint
David CARLIER via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 17 11:59:05 PDT 2018
devnexen 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))
----------------
devnexen wrote:
> dberris wrote:
> > devnexen wrote:
> > > dberris wrote:
> > > > devnexen wrote:
> > > > > dberris wrote:
> > > > > > Do you actually need this change? Why isn't `getToolChain().AddCXXStdlibLibArgs(...)` not sufficient here?
> > > > > That s the thing, I wish it was simple as FreeBSD, but seemingly in OpenBSD needs both c++98 gcc runtime and libc++ for fuzzer (I tried libc++ alone already)
> > > > Right, but this comment is on this specific line change. I don't think you need to reach into `Toolchain.` direcly, since you can already use `getToolChain()` just from the above line (188).
> > > Right, so I guess this diff https://reviews.llvm.org/D45662?id=142686 is sufficient then ?
> > No. Let me try and explain again.
> >
> > You were on the right path, with overriding the `AddCXXStdlibLibArgs` function in the OpenBSD Toolchain type. It's just that you weren't handling the case for when the binary was being built with libc++ or libstdc++ properly. I was referring you to what FreeBSD was doing for their implementation of `AddCXXStdlibLibArgs`. This means, checking first whether the invocation of the compiler was using libc++ or libstdc++, and then adding the appropriate link spelling. That all happens in the `AddCXXStdlibLibArgs` implementation, because there's no need to special-case just for the sanitizers.
> >
> > This means, if you're building a normal binary with `-pg` in OpenBSD against either libc++ or libstdc++, it wouldn't work correctly regardless of whether you were using libFuzzer.
> >
> > Does that make more sense?
> Ok will try a newer version later, thanks for your inputs.
So I looked at FreeBSD and makes more sense by default it s libcxx since the 10.x releases. A release has a few years span of support. OpenBSD has complete different release policy, much shorter and two releases per year. clang been in since 6.2 (and we re at 6.3 now and the time llvm 7 comes out it will be 6.4).
https://reviews.llvm.org/D45662
More information about the cfe-commits
mailing list