Skip to content

Query rustc for clang target triples #994

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

Closed
djkoloski opened this issue Mar 6, 2024 · 1 comment · Fixed by #1004
Closed

Query rustc for clang target triples #994

djkoloski opened this issue Mar 6, 2024 · 1 comment · Fixed by #1004

Comments

@djkoloski
Copy link

djkoloski commented Mar 6, 2024

Right now, we pick the target triples to pass clang by defaulting to the first segment of the target triple and then manually fixing them up with a large set of branches. Is there a way we could query the target spec from rustc to get the LLVM target names? For example, by running:

$ rustc +nightly -Zunstable-options --print all-target-specs-json

We can obtain a JSON dump of all of the target configurations. Each target configuration contains an "llvm-target" field which we should be passing to clang. That's not stable right now, but maybe there's some other way to work with that?

@NobodyXu
Copy link
Collaborator

NobodyXu commented Mar 6, 2024

We can obtain a JSON dump of all of the target configurations. Each target configuration contains an "llvm-target" field which we should be passing to clang.

Maybe we could add pre-generate them, in the same way we generate windows syscall bindings (in dev-tools/generate-windows-sys-bindings)?

E.g. add a new non-publish-able crate in the workspace that query the rustc and generate a .rs file containing the mapping.

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

Successfully merging a pull request may close this issue.

2 participants