-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Improve the DynamicLinker
API and fix detectAbiAndDynamicLinker()
for non-Linux/Hurd ELF hosts
#21617
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alexrp
force-pushed
the
target-dyld-stuff
branch
from
October 7, 2024 06:18
2ef89c5
to
11ffe62
Compare
lgtm, "target": "x86_64-freebsd.14.1...14.1-none",
"target": "x86_64-netbsd.10.0...10.0-none",
"target": "x86_64-netbsd.9.4...9.4-none",
"target": "x86_64-openbsd.7.5...7.5-none",
"target": "x86_64-dragonfly.6.4...6.4-none", |
Nice, thanks for testing! |
@andrewrk just need your thoughts on the new |
alexrp
force-pushed
the
target-dyld-stuff
branch
from
October 15, 2024 17:29
11ffe62
to
3f88b13
Compare
This helps callers of DynamicLinker.standard() make informed decisions about the usefulness of the returned value.
hasDynamicLinker() was just kind of lying in the case of Darwin platforms for the benefit of std.zig.system.detectAbiAndDynamicLinker(). A better name would have been hasElfDynamicLinker() or something. It also got the answer wrong for a bunch of platforms that don't actually use ELF. Anyway, this was clearly the wrong layer to do this at, so remove this function and instead use DynamicLinker.kind() + an isDarwin() check in detectAbiAndDynamicLinker().
…F hosts. Since we exclude Abi.none from the list of ABIs to be tested, it means that Abi.gnu, which happens to be the first in the list, always gets picked for hosts where the dynamic linker path does not depend on the ABI component of the triple. Such hosts include all the BSDs, Haiku, Serenity, Solaris, etc. To fix this, use DynamicLinker.kind() to determine whether this whole exercise even makes sense. If it doesn't, as is the case on every OS other than Linux and Hurd, we'll just fall back to Abi.default() which will try to pick a sensible default based on the arch and OS components. This detection logic still has plenty of room for improvement, but is at least a notable step up from confusingly detecting Abi.gnu ~everywhere. Closes ziglang#9089.
Its semantics are now documented in terms of DynamicLinker.kind(os.tag). The idea here is two-fold: * The term "standard" actually means something; we shouldn't return a valid dynamic linker path for a triple for which it hasn't *actually* been standardized. That's just incorrect. For example, previously, this function would happily return a path for x86_64-linux-androideabi, csky-macos-gnu, or aarch64-hurd-msvc, and other such obvious nonsense. * Callers that use the return value from this function to do host probing (such as std.zig.system.detectAbiAndDynamicLinker()) can now do so with greater confidence because DynamicLinker.standard() will eagerly reject nonsensical target triples.
alexrp
force-pushed
the
target-dyld-stuff
branch
from
October 26, 2024 20:00
3f88b13
to
059f188
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #9089.