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

SIGILL with -C target-cpu=native #36448

Closed
LukasKalbertodt opened this issue Sep 13, 2016 · 4 comments
Closed

SIGILL with -C target-cpu=native #36448

LukasKalbertodt opened this issue Sep 13, 2016 · 4 comments

Comments

@LukasKalbertodt
Copy link
Member

LukasKalbertodt commented Sep 13, 2016

(this issue was originally opened here (backtrace-rs/16))

This code:

fn main() {
    println!("{:?}", std::env::current_dir());
}

... when compiled with rustc -C target-cpu=native test.rs, results in a SIGILL when executed:

$ ./test
Illegal instruction (core dumped)

A few information via gdb:

(gdb) r
Starting program: /home/lukas/dev/test
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGILL, Illegal instruction.
0x000055555555978b in test::main::h12b07f12a4defd77 ()
(gdb) bt
#0  0x000055555555978b in test::main::h12b07f12a4defd77 ()
#1  0x0000555555562719 in std::panicking::try::call::hca715a47aa047c49 ()
#2  0x000055555556a6bc in __rust_try ()
#3  0x000055555556a65f in __rust_maybe_catch_panic ()
#4  0x00005555555621bf in std::rt::lang_start::h162055cb2e4b9fe7 ()
#5  0x000055555555a1fa in main ()

When switching to (gdb) layout asm this instruction is marked:

vmovdqu64 0x25321b(%rip),%xmm0

Google lead me to think this is an instruction of the AVZ-512 extension. Without having searched for a long time, I think my CPU, the i7-6700HQ, does not support this extension.


Some information, @alexcrichton requested:

lukas@calcifer:~$ uname -a
Linux calcifer 4.4.0-36-generic #55-Ubuntu SMP Thu Aug 11 18:01:55 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
lukas@calcifer:~$ rustc -vV
rustc 1.11.0 (9b21dcd6a 2016-08-15)
binary: rustc
commit-hash: 9b21dcd6a89f38e8ceccb2ede8c9027cb409f6e3
commit-date: 2016-08-15
host: x86_64-unknown-linux-gnu
release: 1.11.0
lukas@calcifer:~$ cat /proc/cpuinfo 
processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model       : 94
model name  : Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
stepping    : 3
microcode   : 0x84
cpu MHz     : 800.007
cache size  : 6144 KB
physical id : 0
siblings    : 8
core id     : 0
cpu cores   : 4
apicid      : 0
initial apicid  : 0
fpu     : yes
fpu_exception   : yes
cpuid level : 22
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt xsaveopt xsavec xgetbv1 dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp
bugs        :
bogomips    : 5183.88
clflush size    : 64
cache_alignment : 64
address sizes   : 39 bits physical, 48 bits virtual
power management:

( ... and seven more cores with the exact same data ... )

If you need more information or want to see something executed on my system, just tell me!

@LukasKalbertodt
Copy link
Member Author

Affects a friend, too. His data:

$ rustc -vV
rustc 1.11.0 (9b21dcd6a 2016-08-15)
binary: rustc
commit-hash: 9b21dcd6a89f38e8ceccb2ede8c9027cb409f6e3
commit-date: 2016-08-15
host: x86_64-unknown-linux-gnu
release: 1.11.0

$ cat /proc/cpuinfo 
processor  : 0
vendor_id  : GenuineIntel
cpu family  : 6
model    : 78
model name  : Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz
stepping  : 3
microcode  : 0x74
cpu MHz    : 2344.968
cache size  : 3072 KB
physical id  : 0
siblings  : 4
core id    : 0
cpu cores  : 2
apicid    : 0
initial apicid  : 0
fpu    : yes
fpu_exception  : yes
cpuid level  : 22
wp    : yes
flags    : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt xsaveopt xsavec xgetbv1 dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp
bugs    :
bogomips  : 4800.44
clflush size  : 64
cache_alignment  : 64
address sizes  : 39 bits physical, 48 bits virtual
power management:

( ... three more cores with the same data ... )

@jonas-schievink
Copy link
Contributor

Smells like an LLVM bug. Can you reproduce on the current Rust nightly?

@LukasKalbertodt
Copy link
Member Author

$ rustup run nightly rustc -vV
rustc 1.13.0-nightly (0be88eb79 2016-09-11)
binary: rustc
commit-hash: 0be88eb794949d27331ec45c300a40369b541001
commit-date: 2016-09-11
host: x86_64-unknown-linux-gnu
release: 1.13.0-nightly
$ rustup run nightly rustc -C target-cpu=native test.rs
$ ./test
Ok("my/current/dir")

I always forget to test with nightly 😖

So I guess this can be closed?

@nagisa
Copy link
Member

nagisa commented Sep 13, 2016

This should be closed. LLVM didn’t handle skylake features (despite understanding what skylake is) well before and including 3.8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants