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

Our 32-bit Sparc handling isn't quite correct yet #132585

Open
workingjubilee opened this issue Nov 4, 2024 · 1 comment · May be fixed by #132552
Open

Our 32-bit Sparc handling isn't quite correct yet #132585

workingjubilee opened this issue Nov 4, 2024 · 1 comment · May be fixed by #132552
Labels
C-bug Category: This is a bug. O-linux Operating system: Linux O-SPARC Target: SPARC processors T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@workingjubilee
Copy link
Member

workingjubilee commented Nov 4, 2024

See:

We need to, for compiling for 32-bit SPARC, distinguish when we should use the appropriate Elf Machine for V8 vs. V8+. This is necessary because this is the primary way of detecting instruction incompatibility for the architecture: providing a CPUID via instruction or register read at runtime hadn't become fashionable yet.

@workingjubilee workingjubilee added C-bug Category: This is a bug. O-linux Operating system: Linux O-SPARC Target: SPARC processors T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 4, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 4, 2024
@taiki-e
Copy link
Member

taiki-e commented Nov 4, 2024

An additional complication here is that LLVM also works differently in different versions for this.

  • LLVM 18 always uses EM_SPARC (code)
  • LLVM 19 uses EM_SPARC32PLUS if the v9 feature (which is also a feature that indicates whether certain instructions are available) is enabled, otherwise EM_SPARC (code)
  • LLVM 20 (unreleased) uses EM_ SPARC32PLUS if the v8plus feature (which is an independent feature not tied to any other feature) is enabled, otherwise EM_SPARC (code)

#131222 implements the behavior of LLVM 19 somewhat imperfectly, and the feature will be added in #132552 can be used to make it exactly match LLVM 19.

The behavior of LLVM 20 is consistent with that of GCC (that -mcpu=v9 does not imply -mv8plus), and I think eventually we will need to match it. (See #132552 (comment) for the motivation for this behavior.)

IIUC, my patch mentioned in #132552 (comment) (0849356) works the same way as LLVM in each LLVM version. (Of course, the problem with that patch is that it behaves differently depending on the LLVM version (until LLVM 20 is the minimal LLVM version).)

@jieyouxu jieyouxu removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. O-linux Operating system: Linux O-SPARC Target: SPARC processors T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
4 participants