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

Rustc illegal instruction on powerpc #85238

Closed
clienthax opened this issue May 12, 2021 · 8 comments
Closed

Rustc illegal instruction on powerpc #85238

clienthax opened this issue May 12, 2021 · 8 comments
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ O-PowerPC Target: PowerPC processors T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@clienthax
Copy link

clienthax commented May 12, 2021

This is likely something no one else is attempting.., Testing out rust on a PS3 running T2SDE linux
Related:
rust-lang/cargo#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 <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 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 <OPENSSL_altivec_probe+0>:        vmr     v0,v0
   0x00a87044 <OPENSSL_altivec_probe+4>:        blr
   0x00a87048 <OPENSSL_altivec_probe+8>:        .long 0x0
   0x00a8704c <OPENSSL_altivec_probe+12>:       .long 0xc1400
   0x00a87050 <OPENSSL_altivec_probe+16>:       .long 0x0
   0x00a87054:  nop
   0x00a87058:  nop
   0x00a8705c:  nop
=> 0x00a87060 <OPENSSL_crypto207_probe+0>:      lxvd2x  vs32,0,r1
   0x00a87064 <OPENSSL_crypto207_probe+4>:      vcipher v0,v0,v0
   0x00a87068 <OPENSSL_crypto207_probe+8>:      blr
   0x00a8706c <OPENSSL_crypto207_probe+12>:     .long 0x0
   0x00a87070 <OPENSSL_crypto207_probe+16>:     .long 0xc1400
   0x00a87074 <OPENSSL_crypto207_probe+20>:     .long 0x0
   0x00a87078:  nop
   0x00a8707c:  nop

@clienthax clienthax added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 12, 2021
@nagisa
Copy link
Member

nagisa commented May 12, 2021

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
Copy link
Author

clienthax commented May 14, 2021

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
Copy link
Member

nagisa commented May 14, 2021

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

@clienthax
Copy link
Author

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
Copy link
Contributor

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

@glaubitz
Copy link
Contributor

Regression was introduced by 0328e69

See #81334

@sanxiyn
Copy link
Member

sanxiyn commented Nov 13, 2021

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

@sanxiyn sanxiyn added the O-PowerPC Target: PowerPC processors label Nov 13, 2021
@workingjubilee
Copy link
Member

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.

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. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ O-PowerPC Target: PowerPC processors T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants