Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 932734 - dev-lang/rust-bin-1.77.1 crashes with "Illegal Instruction" on Sparc
Summary: dev-lang/rust-bin-1.77.1 crashes with "Illegal Instruction" on Sparc
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: Sparc64 Linux
: Normal normal (vote)
Assignee: Sparc Porters
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-05-25 14:26 UTC by spock128
Modified: 2024-06-01 19:31 UTC (History)
7 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (file_932734.txt,6.33 KB, text/plain)
2024-05-25 14:30 UTC, spock128
Details

Note You need to log in before you can comment on or make changes to this bug.
Description spock128 2024-05-25 14:26:54 UTC
rustc and cargo both crash with "Illegal instruction" on this version of rust-bin. Rolling back to 1.76.0 results in a working install.

Reproducible: Always

Steps to Reproduce:
1. emerge -1 =dev-lang/rust-bin-1.77.1
2. rustc --version
Actual Results:  
"Illegal instruction" and exits

Expected Results:  
rustc runs normally

# lscpu
Architecture:          sparc64
  CPU op-mode(s):      32-bit, 64-bit
  Byte Order:          Big Endian
CPU(s):                1
  On-line CPU(s) list: 0
Model name:            TI UltraSparc IIi (Sabre)
  Thread(s) per core:  1
  Core(s) per socket:  1
  Socket(s):           1
  Flags:               sun4u
Caches (sum of all):   
  L1d:                 16 KiB (1 instance)
  L1i:                 16 KiB (1 instance)
  L2:                  2 MiB (1 instance)
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-05-25 14:28:30 UTC
arthur, did you build it with default *FLAGS? I made that error before (not doing that).
Comment 2 spock128 2024-05-25 14:30:01 UTC
Created attachment 894356 [details]
emerge --info
Comment 3 Arthur Zamarin archtester Gentoo Infrastructure gentoo-dev Security 2024-05-25 16:51:29 UTC
(In reply to Sam James from comment #1)
> arthur, did you build it with default *FLAGS? I made that error before (not
> doing that).

I don't know, sorry. I've just ran this command in "arthurzam-sparc64-stable" container on catbus:

> USE="dist system-bootstrap" emerge --autounmask=y --autounmask-continue=y -v1 ~dev-lang/rust-1.77.1 ~virtual/rust-1.77.1
Comment 4 matoro archtester 2024-05-25 17:30:23 UTC
Can you please check with gdb what instruction it is crashing on?  That will at least let us figure out what target level it was incorrectly built for.  It works fine on my T4, for example:

# rustc --version
rustc 1.77.1 (7cf61ebde 2024-03-27) (gentoo)
# eselect rust list
Available Rust versions:
  [1]   rust-bin-1.77.1 *
Comment 5 spock128 2024-05-25 19:00:40 UTC
This is what I think you're asking for, but I don't know a ton about Sparc assembly:

(gdb) r --version
Starting program: /usr/bin/rustc --version
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Program received signal SIGILL, Illegal instruction.
0xfffff80107f4f6fc in __sparc_get_pc_thunk.l7 () from /usr/lib/rust/lib/libstd-1cf51602b88a03e8.so
(gdb) disassemble
...
   0xfffff80107f4f6e8 <+168>:   sub  %g1, %o0, %g1
   0xfffff80107f4f6ec <+172>:   srax  %g1, 3, %g2
   0xfffff80107f4f6f0 <+176>:   srlx  %g1, 0x3f, %o1
   0xfffff80107f4f6f4 <+180>:   add  %o1, %g2, %o1
   0xfffff80107f4f6f8 <+184>:   srax  %o1, 1, %o1
=> 0xfffff80107f4f6fc <+188>:   cxbe  %o1, 0, 0xfffff80107f4f71c <__sparc_get_pc_thunk.l7+220>
   0xfffff80107f4f700 <+192>:   sethi  %hi(0x6400), %g1
   0xfffff80107f4f704 <+196>:   xor  %g1, 0x2b0, %g1
   0xfffff80107f4f708 <+200>:   ldx  [ %l7 + %g1 ], %l7
   0xfffff80107f4f70c <+204>:   cxbe  %l7, 0, 0xfffff80107f4f71c <__sparc_get_pc_thunk.l7+220>
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-05-25 19:03:32 UTC
(In reply to Arthur Zamarin from comment #3)
> (In reply to Sam James from comment #1)
> > arthur, did you build it with default *FLAGS? I made that error before (not
> > doing that).
> 
> I don't know, sorry. I've just ran this command in
> "arthurzam-sparc64-stable" container on catbus:
> 
> > USE="dist system-bootstrap" emerge --autounmask=y --autounmask-continue=y -v1 ~dev-lang/rust-1.77.1 ~virtual/rust-1.77.1

That container has: COMMON_FLAGS="-O2 -mcpu=niagara4 -pipe"

So it needs to be rebuilt without that.
Comment 7 matoro archtester 2024-05-25 19:13:40 UTC
(In reply to Sam James from comment #6)
> (In reply to Arthur Zamarin from comment #3)
> > (In reply to Sam James from comment #1)
> > > arthur, did you build it with default *FLAGS? I made that error before (not
> > > doing that).
> > 
> > I don't know, sorry. I've just ran this command in
> > "arthurzam-sparc64-stable" container on catbus:
> > 
> > > USE="dist system-bootstrap" emerge --autounmask=y --autounmask-continue=y -v1 ~dev-lang/rust-1.77.1 ~virtual/rust-1.77.1
> 
> That container has: COMMON_FLAGS="-O2 -mcpu=niagara4 -pipe"
> 
> So it needs to be rebuilt without that.

I do believe you need to make sure that it does have at least -mcpu=ultrasparc which is what our stage3s use because otherwise it defaults to v7 or something stupid.
Comment 8 Arthur Zamarin archtester Gentoo Infrastructure gentoo-dev Security 2024-06-01 05:04:22 UTC
I'll build fixed tarball for 1.78.0 for sparc, not sure what is best for 1.77.1 - maybe remove the sparc tarball, or should I rebuild it?
Comment 9 matoro archtester 2024-06-01 16:28:40 UTC
(In reply to Arthur Zamarin from comment #8)
> I'll build fixed tarball for 1.78.0 for sparc, not sure what is best for
> 1.77.1 - maybe remove the sparc tarball, or should I rebuild it?

You can drop it and de-keyword once 1.78.0 tarball is up, no sweat.
Comment 10 Larry the Git Cow gentoo-dev 2024-06-01 18:50:51 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1128c70592a612f9dc66d32665289efbe799a699

commit 1128c70592a612f9dc66d32665289efbe799a699
Author:     Arthur Zamarin <arthurzam@gentoo.org>
AuthorDate: 2024-06-01 18:48:40 +0000
Commit:     Arthur Zamarin <arthurzam@gentoo.org>
CommitDate: 2024-06-01 18:50:12 +0000

    dev-lang/rust-bin: add tarball for sparc & mips
    
    Bug: https://bugs.gentoo.org/932734
    Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>

 dev-lang/rust-bin/Manifest               |  5 +++++
 dev-lang/rust-bin/rust-bin-1.78.0.ebuild | 22 +++++++++++-----------
 2 files changed, 16 insertions(+), 11 deletions(-)
Comment 11 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-06-01 19:31:55 UTC
(In reply to Arthur Zamarin from comment #8)
> I'll build fixed tarball for 1.78.0 for sparc, not sure what is best for
> 1.77.1 - maybe remove the sparc tarball, or should I rebuild it?

I'd say please rebuild it as it's easier if we have a clean path without jumps.