-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Correct VFS libc modulemap injection condition. #60265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
cc @egorzhdan |
@swift-ci please smoke test |
@swift-ci please smoke test macOS |
Heh, looks like this pull broke two PS4 tests: 🤣
|
488e7a6
to
e55300c
Compare
Alright, this should pass the CI now. |
Yep, that was a rather astonishing test failure. |
Apparently Saleem added some PS4 support in #3221 a little more than six years ago: I had no idea that pull existed. |
Ping. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay!
I think the condition should remain in the form of "what OSes we want to apply this to" and not "what OSes do we skip the injection", otherwise someone porting Swift to a new platform in the future will encounter a very surprising behavior.
Can you do something like triple.isGlibc() || triple.isOpenBSD() || triple.isFreeBSD()
?
e55300c
to
9457f40
Compare
I have factored this a little more for clarity with some of your suggestion. If this LGTY as-is, then good, but I'm still thinking about the problem where a porter for a new platform comes across missing modulemap errors during compilation, but aren't immediately directed to this point in the code and to the decision they need to make. However, the way to solve this is to force an |
@swift-ci please smoke test |
@@ -171,11 +171,15 @@ createClangArgs(const ASTContext &ctx, clang::driver::Driver &clangDriver) { | |||
return clangDriverArgs; | |||
} | |||
|
|||
static bool shouldInjectGlibcModulemap(const llvm::Triple &triple) | |||
{ | |||
return triple.isOSGlibc() || triple.isOSOpenBSD() || triple.isOSFreeBSD(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will break the native Android build, please add Android here and maybe a comment explaining why we're adding these non-glibc platforms.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done; can you pick and retest?
9457f40
to
7bb61cc
Compare
We should only be skipping VFS libc modulemap injection on Darwin and Windows. Unfortunately, we cannot just use the isOSGlibc Triple method because LLVM's sense of Glibc (does the platform _actually use_ glibc) differs from Swift's sense of Glibc (does the platform use libc). There may be other non-libc platforms that we should skip VFS injection on but let's correct the conditional for now and other prs should add those platforms as necessary.
7bb61cc
to
6a55161
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
@swift-ci please smoke test |
We should only be skipping VFS libc modulemap injection on Darwin and
Windows. Unfortunately, we cannot use the isOSGlibc Triple method because
LLVM's sense of Glibc (does the platform actually use glibc) differs
from Swift's sense of Glibc (does the platform use libc).
There may be other non-libc platforms that we should skip VFS injection
on but let's correct the conditional for now and other prs should add
those platforms as necessary.