This is an archive of the discontinued LLVM Phabricator instance.

[Clang][Driver] Fix include paths for `--sysroot /` on OpenBSD/FreeBSD
ClosedPublic

Authored by egorzhdan on Jul 13 2022, 8:47 AM.

Details

Diff Detail

Event Timeline

egorzhdan created this revision.Jul 13 2022, 8:47 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 13 2022, 8:47 AM
egorzhdan requested review of this revision.Jul 13 2022, 8:47 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJul 13 2022, 8:47 AM
MaskRay added a comment.EditedJul 13 2022, 11:01 AM

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).

brad added a comment.Jul 13 2022, 6:17 PM

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.

3405691582 accepted this revision.EditedJul 13 2022, 6:53 PM

LGTM. Tested change on OpenBSD resolves downstream issues, was not able to check FreeBSD.

This revision is now accepted and ready to land.Jul 13 2022, 6:53 PM
brad added a comment.Jul 13 2022, 7:42 PM

Tested change on OpenBSD resolves downstream issues.

What issues?

Tested change on OpenBSD resolves downstream issues.

What issues?

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.

brad added a comment.Jul 14 2022, 10:10 PM

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.

Ah, that clarifies things. Thank you.

brad added a comment.EditedJul 14 2022, 10:14 PM

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="" ".

  • Add a test for OpenBSD
  • Modify existing test file instead of adding a new file
brad accepted this revision.Jul 20 2022, 6:09 PM