NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/47248: Using -march=native on Intel I5 causes illegal instructions

>Number:         47248
>Category:       kern
>Synopsis:       Using -march=native on Intel I5 causes illegal instructions
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Nov 26 10:10:00 +0000 2012
>Originator:     Jaap Boender
>Release:        6.0_STABLE
NetBSD 6.0_STABLE NetBSD 6.0_STABLE (PURCELL) #6: Tue Nov 20 
14:03:01 GMT 2012 amd64
[See also the discussion on port-amd64, starting here: ]

On my laptop, which has an Intel i5-3320 CPU (see below for cpuctl output), 
using devel/cpuflags results in the kernel, toolchain and distribution being 
compiled with
-march=native -msse3 -mfpmath=sse. This works fine for kernel and toolchain, 
but after installing the new distribution, every executable I try to run 
coredumps with "Illegal instruction".

This seems to be a problem with AVX instructions being generated, but the AVX 
bit in the kernel not being set.

An example of a generated executable and its core dump can be found on in /pub/NetBSD/misc/jaapb/amd64_ill/gawk{,core} .

-- cpuctl identify output --
cpu0: Intel Pentium Pro, II or III (686-class), 2591.84 MHz, id 0x306a9
cpu0: features  0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR>
cpu0: features  0xbfebfbff<PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR>
cpu0: features  0xbfebfbff<SSE,SSE2,SS,HTT,TM,SBF>
cpu0: features2 0x77bae3ff<SSE3,PCLMULQDQ,DTES64,MONITOR,DS-CPL,VMX,SMX,EST>
cpu0: features2 0x77bae3ff<TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE41,SSE42,X2APIC>
cpu0: features2 0x77bae3ff<POPCNT,B24,AES,XSAVE,AVX,F16C,B30>
cpu0: features3 0x28100800<SYSCALL/SYSRET,XD,EM64T>
cpu0: features4 0x1<LAHF>
cpu0: "Intel(R) Core(TM) i5-3320M CPU @ 2.60GHz"
cpu0: ITLB 64 4KB entries 4-way
cpu0: DTLB 64 4KB entries 4-way
cpu0: Initial APIC ID 0
cpu0: Cluster/Package ID 0
cpu0: Core ID 0
cpu0: SMT ID 0
cpu0: family 06 model 0a extfamily 00 extmodel 03 stepping 09
cpu0: UCode version: ?

Compile something with the -march=native flag on an Intel i5-3320 CPU. I 
detected the problem with distribution, but just compiling lang/gawk 
also triggers the problem.
A workaround is not using -march=native but -march=core2. This works fine.

Home | Main Index | Thread Index | Old Index