-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
rustc broken on sparc64 #45509
Comments
Would adding |
If the (Of course the proper fix is to fix the underlying issue of unaligned access being generated in the first place, but a temporary fix would allow sparc64 to be bootstrapped today.) |
I'm testing such a change now. |
Ok, this works. See the PR above. I'm not sure whether this is the best way to write the conditional compiling, but it works. I'm open for suggestions on improving this, of course :). |
Due the limitation that #[derive(...)] on #[repr(packed)] structs does not guarantee proper alignment of the compiler-generated impls is not guaranteed (rust-lang#39696), the change in rust-lang#44646 to compress Spans results in the compiler generating code with unaligned access. Until rust-lang#39696 has been fixed, the issue can be worked around by not using the packed attribute on sparc64 and sparcv9 on the Span struct. Fixes: rust-lang#45509
This sounds like a bad hack. For one, the repr(packed) should just be ignored in this case (where cpu alignment forces the same layout), and second (as noted above) there is no excuse to generate bogus code for this case. |
It's a workaround which is necessary as #39696 hasn't been resolved yet and is apparently not easy to fix. Feel free to suggest a better solution. |
So, with a current rustc snapshot from git, this particular issue with rustc throwing a SIGBUS is gone and when including the patch by @jrtc27 to fix the stack alignment on SPARC (rust-lang/llvm#94), I can cross-build a Rust compiler for sparc64-unknown-linux-gnu which no longer crashes. However, using that cross-compiled rustc for sparc64 apparently produces broken binaries:
|
Ok, with the latest git snapshot, the compiler now works fine for me on sparc64-linux-gnu. So, I think it's safe to close this issue now. |
Closing as requested. |
During a rust build on sparc64, the following crash is observed:
This is a side effect of #44646 which runs into #39696. Many (if not all) constructors of
syntax::ext::tt::quoted::TokenTree
create aSpan
member (which is nowrepr(packed)
) inside the discriminated union. The discriminator is a single byte, so the Span member is laid out at offset 1 (and followed by 3 padding bytes, so packing didn't gain us anything). The automatically derivedPartialEq
instance forTokenTree
crashes when comparing e.g. twoToken
objects, because after the tag comparison (0 in both cases), it performs unaligned loads on the Span values resulting in a bus error.The text was updated successfully, but these errors were encountered: