Skip to content
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

Make a distinction between LLVM and rustc target triples #111

Open
madsmtm opened this issue Sep 29, 2024 · 4 comments
Open

Make a distinction between LLVM and rustc target triples #111

madsmtm opened this issue Sep 29, 2024 · 4 comments

Comments

@madsmtm
Copy link
Contributor

madsmtm commented Sep 29, 2024

It isn't really clear from the documentation whether this crate parses LLVM or rustc target triples, and that's probably because it tries to parse both.

This is problematic though, in particular the triple aarch64-apple-darwin is from my understanding ambiguous?

  • In LLVM's case refers to "the generic Darwin platform, i.e. any of macOS/iOS/tvOS/watchOS/visionOS" (from my experiments, the LLVM target is mostly defunct by itself). The macOS triple is aarch64-apple-macosx.
  • When using Clang, the chosen platform depends on the currently active SDK, and/or the presence of other flags like -miphoneos-version-min=....
  • In rustc's case it refers to "the macOS platform".

Would it make sense to say "FromStr only parses rustc triples", or "FromStr only parses LLVM triples"? Or maybe add Triple::from_llvm(&str) -> Result<Self> and Triple::from_rustc(&str) -> Result<Self>, and remove FromStr?

@madsmtm
Copy link
Contributor Author

madsmtm commented Sep 29, 2024

Another solution would be to rename rustc's macOS targets to *-apple-macos, which is desirable anyhow. But that's a complicated process.

@madsmtm
Copy link
Contributor Author

madsmtm commented Sep 29, 2024

This is also relevant for figuring out how to parse deployment targets for iOS/tvOS/watchOS/visionOS targets (since what we do here depends on what target-lexicon intends on supporting).

@madsmtm
Copy link
Contributor Author

madsmtm commented Sep 30, 2024

I see that this has also been discussed a bit in #78.

@sunfishcode
Copy link
Member

target-lexicon was written at a time when there was a combination of a lack of alternatives, and a lack of understanding on my part of the relationship between rust target names and LLVM target names.

If one only wants to work with Rust target names now, it may be better to switch to the platforms crate instead.

Perhaps this means that target-lexicon should ideally migrate to focusing only on LLVM target names.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants