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

Fix armv7-sony-vita-newlibeabihf LLVM target triple #138426

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

madsmtm
Copy link
Contributor

@madsmtm madsmtm commented Mar 12, 2025

It was previously normalized by LLVM to thumbv7a-vita-unknown-eabihf (can be seen with clang -target thumbv7a-vita-eabihf -v), which seems wrong, as Vita is the OS name.

Motivation: To make it easier to verify that cc-rs' conversion from rustc to Clang/LLVM triples is correct.

CC target maintainers @nikarh, @pheki and @zetanumbers.
r? jieyouxu

It was previously normalized by LLVM to `thumbv7a-vita-unknown-eabihf`,
which is probably wrong, as Vita is the OS.
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 12, 2025
@rustbot
Copy link
Collaborator

rustbot commented Mar 12, 2025

These commits modify compiler targets.
(See the Target Tier Policy.)

@madsmtm
Copy link
Contributor Author

madsmtm commented Mar 12, 2025

Another thing to consider: Is thumbv7a the correct arch to pass to LLVM, or should it actually be armv7 like the target name?

@jieyouxu
Copy link
Member

This seems to be basically if the target maintainers agree with this change, so please r=me if they do.
@bors delegate+ rollup

@bors
Copy link
Contributor

bors commented Mar 12, 2025

✌️ @madsmtm, you can now approve this pull request!

If @jieyouxu told you to "r=me" after making some further change, please make that change, then do @bors r=@jieyouxu

@jieyouxu
Copy link
Member

@rustbot blocked (waiting to hear back from target maintainers, not much for me or PR author to do)

@rustbot rustbot added S-blocked Status: Blocked on something else such as an RFC or other implementation work. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 12, 2025
@pheki
Copy link
Contributor

pheki commented Mar 13, 2025

Interestingly some docs from Clang indicate that the vendor is optional but sys not so much: "The vendor needs to be specified only if there’s a relevant change, for instance between PC and Apple. Most of the time it can be omitted (and Unknown) will be assumed, which sets the defaults for the specified architecture. The system name is generally the OS (linux, darwin), but could be special like the bare-metal “none”."

That said, I'm personally fine with this change with one caveat: sony does not seem to be a valid target for LLVM[0] [1], it seems like they use SCEI for the PS4 and PS5, so that would probably make more sense. I checked for LLVM code checking for SCEI specifically and they don't seem to have any special cases that would affect us, so this probably wouldn't break anything.

@zetanumbers
Copy link
Contributor

I have originally used bare-metal llvm target arm7a-unknown-none or something like that, cause there's no vita support in clang. thumb7a was intentional, assuming such llvm target is sound.

@madsmtm
Copy link
Contributor Author

madsmtm commented Mar 13, 2025

Interestingly some docs from Clang indicate that the vendor is optional but sys not so much: "The vendor needs to be specified only if there’s a relevant change, for instance between PC and Apple. Most of the time it can be omitted (and Unknown) will be assumed, which sets the defaults for the specified architecture. The system name is generally the OS (linux, darwin), but could be special like the bare-metal “none”."

Yeah, arguably the invalid normalization could be a LLVM bug?

I picked sony because that's what's passed by the mipsel-sony-psp/mipsel-sony-psx targets, and because LLVM is fine with invalid/unknown target vendors (and this does allow a forked LLVM to handle it differently if it wants to).

I'm fine with arm7a-unknown-none-eabihf or something else instead if that's what you prefer (though I do think it'd be nice if it was consistent with the other sony targets).

@pheki
Copy link
Contributor

pheki commented Mar 13, 2025

thumbv7a is probably better as it is a thumb processor this target has thumb mode enabled. I'm personally in favor of either thumbv7a-sony-vita-eabihf or thumbv7a-scei-vita-eabihf in case we ever need to fork / contribute to llvm.

Edit: fixed target names

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-blocked Status: Blocked on something else such as an RFC or other implementation work. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants