rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
97.56k stars 12.62k forks source link

Rustc illegal instruction on powerpc #85238

Closed clienthax closed 2 years ago

clienthax commented 3 years ago

This is likely something no one else is attempting.., Testing out rust on a PS3 running T2SDE linux Related: https://github.com/rust-lang/cargo/issues/6320 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=788720

Code

fn main() {
    println!("Hello World!");
}

Meta

rustc --version --verbose:

rustc 1.52.1 (9bc8c42bb 2021-05-09)
binary: rustc
commit-hash: 9bc8c42bb2f19e745a63f3445f1ac248fb015e53
commit-date: 2021-05-09
host: powerpc-unknown-linux-gnu
release: 1.52.1
LLVM version: 12.0.0

Error output

rustc ./hello.rs
Illegal instruction (core dumped)
GDB Backtrace

``` root@localhost:~/rust# gdb rustc GNU gdb (GDB) 10.1 Copyright (C) 2020 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "powerpc64-t2-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: . Find the GDB manual and other documentation resources online at: . For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from rustc... r(gdb) run ./hello.rs Starting program: /root/.cargo/bin/rustc ./hello.rs warning: Unable to find dynamic linker breakpoint function. GDB will be unable to debug shared library initializers and track explicitly loaded dynamic code. warning: Could not load shared library symbols for 7 libraries, e.g. /usr/lib/libgcc_s.so.1. Use the "info sharedlibrary" command to see the complete listing. Do you need "set solib-search-path" or "set sysroot"? Program received signal SIGILL, Illegal instruction. 0x00a87060 in OPENSSL_crypto207_probe () (gdb) (gdb) backtrace #0 0x00a87060 in OPENSSL_crypto207_probe () #1 0x004a3764 in OPENSSL_cpuid_setup () #2 0x00b2e118 in __do_global_ctors_aux () #3 0x004a2084 in _init () #4 0x00b2dfd4 in __libc_csu_init () #5 0x40062f5c in ?? () #6 0x40063040 in ?? () #7 0x00000000 in ?? () Dump of assembler code from 0xa87040 to 0xa87080: 0x00a87040 : vmr v0,v0 0x00a87044 : blr 0x00a87048 : .long 0x0 0x00a8704c : .long 0xc1400 0x00a87050 : .long 0x0 0x00a87054: nop 0x00a87058: nop 0x00a8705c: nop => 0x00a87060 : lxvd2x vs32,0,r1 0x00a87064 : vcipher v0,v0,v0 0x00a87068 : blr 0x00a8706c : .long 0x0 0x00a87070 : .long 0xc1400 0x00a87074 : .long 0x0 0x00a87078: nop 0x00a8707c: nop ```

nagisa commented 3 years ago

I suspect this is a crash in a rustup wrapper, I recall seeing a similar issue when trying to run rustc on powerpc a long time ago. This particular backtrace is a problem with openssl, I believe, rather than rustup, rustc or similar.

(Is this the only SIGILL that gdb observes? what happens if you hit continue and let it run further?)

clienthax commented 3 years ago

I suspect this is a crash in a rustup wrapper, I recall seeing a similar issue when trying to run rustc on powerpc a long time ago. This particular backtrace is a problem with openssl, I believe, rather than rustup, rustc or similar.

(Is this the only SIGILL that gdb observes? what happens if you hit continue and let it run further?)


Do you need "set solib-search-path" or "set sysroot"?

Program received signal SIGILL, Illegal instruction. 0x00a87060 in OPENSSL_crypto207_probe () (gdb) continue Continuing.

Program received signal SIGILL, Illegal instruction. 0x00a87084 in OPENSSL_madd300_probe () (gdb) continue Continuing. process 697 is executing new program: /root/.rustup/toolchains/stable-powerpc-unknown-linux-gnu/bin/rustc warning: Could not load symbols for executable /root/.rustup/toolchains/stable-powerpc-unknown-linux-gnu/bin/rustc. Do you need "set sysroot"? warning: Unable to find dynamic linker breakpoint function. GDB will be unable to debug shared library initializers and track explicitly loaded dynamic code. Warning: Cannot insert breakpoint -2. Cannot access memory at address 0x4a3790

nagisa commented 3 years ago

And what happens if you don't use rustup (i.e. invoke /root/.rustup/toolchains/stable-powerpc-unknown-linux-gnu/bin/rustc directly)?

clienthax commented 3 years ago

And what happens if you don't use rustup (i.e. invoke /root/.rustup/toolchains/stable-powerpc-unknown-linux-gnu/bin/rustc directly)?

root@localhost:~/rust# gdb /root/.rustup/toolchains/stable-powerpc-unknown-linux-gnu/bin/rustc
GNU gdb (GDB) 10.1
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "powerpc64-t2-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /root/.rustup/toolchains/stable-powerpc-unknown-linux-gnu/bin/rustc...
(gdb) run ./hello.rs
Starting program: /root/.rustup/toolchains/stable-powerpc-unknown-linux-gnu/bin/rustc ./hello.rs
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
warning: Could not load shared library symbols for 9 libraries, e.g. /root/.rustup/toolchains/stable-powerpc-unknown-linux-gnu/bin/../lib/librustc_driver-f97d9e14fc618140.so.
Use the "info sharedlibrary" command to see the complete listing.
Do you need "set solib-search-path" or "set sysroot"?
[New LWP 977]

Thread 2 "rustc" received signal SIGILL, Illegal instruction.
[Switching to LWP 977]
0x460db18c in ?? ()
(gdb) backtrace
#0  0x460db18c in ?? ()
#1  0x40b45704 in ?? ()
#2  0x40abfc98 in ?? ()
#3  0x40ab3734 in ?? ()
#4  0x40ac0e48 in ?? ()
#5  0x40aeb104 in ?? ()
#6  0x40aecac0 in ?? ()
#7  0x40af9348 in ?? ()
#8  0x00302da0 in ?? ()
#9  0x001e0418 in ?? ()
#10 0x48872d0c in ?? ()
(gdb) disassemble $pc-16,+32
Dump of assembler code from 0x460db17c to 0x460db19c:
   0x460db17c:  mtlr    r0
   0x460db180:  mtctr   r12
   0x460db184:  bctr
   0x460db188:  bl      0x460db190
=> 0x460db18c:  .long 0x2671c64
   0x460db190:  mflr    r3
   0x460db194:  lwz     r4,0(r3)
   0x460db198:  add     r3,r4,r3
End of assembler dump.
(gdb)
glaubitz commented 3 years ago

This is the same bug as #81334. Still present in 1.52.

glaubitz commented 3 years ago

Regression was introduced by 0328e69287b083af4d5d4b49cfc9175e9c82c88e

See #81334

sanxiyn commented 2 years ago

@clienthax, #81334, which is suspected to be same as this bug, is now fixed in the latest release. Can you test again? Thanks!

workingjubilee commented 2 years ago

I'm going to trust @glaubitz's assessment of this as a duplicate of #81334 and close this, in the absence of indications otherwise. This can be reopened if this analysis proves premature down the line.