This is the same change as https://reviews.llvm.org/D126289, but applied for OpenBSD & FreeBSD.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
The code is trivially correct and makes aesthetic improvement.
Regarding the new test: Linux tests organization isn't great. --sysroot tests both include and library search paths, so ideally we use one RUN line to test both.
The name of linux-header-search.cpp focus on just include search path. For FreeBSD/OpenBSD, if you want to start in a clean state, consider adding the RUN line to a generic test (if --sysroot is considered a core functionality) or a test with name implying "cross compilation" (that's why I created linux-cross.cpp).
There is already the initial --sysroot test in test/Driver/openbsd.c. It would be preferable to modify what is there. For FreeBSD a test should be added to test/Driver/freebsd.c.
LGTM. Tested change on OpenBSD resolves downstream issues, was not able to check FreeBSD.
As mentioned, this replicates https://reviews.llvm.org/D126289 for OpenBSD which fixes #28283. That particular issue caused a build problem in Swift's use of VFS in which I verified this patch solves. I was trying to clarify the scope and mechanism in which I tested this change, sorry for the confusion.
Also "-stdlib=libc++" is the default on OpenBSD and FreeBSD so you can probably leave that out and I think you can remove "--gcc-toolchain="" ".