[OE-core] Illegal instruction when running go binaries in qemux86

Khem Raj raj.khem at gmail.com
Sat Oct 7 02:29:11 UTC 2017


On Thu, Oct 5, 2017 at 7:23 AM, Paul Barker <pbarker at toganlabs.com> wrote:
> So, after fixing all my build issues I now have runtime issues :(
>
> Software written in go fails on qemux86 with illegal instruction traps:
>
>     root at qemux86:~# netns ls
>     [   18.984298] traps: netns[491] trap invalid opcode ip:807b541
> sp:bf9694bc error:0[   18.985354]  in netns[8048000+1c3000]
>     Illegal instruction
>     root at qemux86:~# runc
>     traps: runc[492] trap invalid opcode ip:807b561 sp:bff6ec1c
> error:0[   21.604966]  in runc[8048000+457000]
>     Illegal instruction
>
> I've done a git bisect and tracked this down to commit 20b35747
> "qemuboot.conf: make cpus match built artifacts" on master. This has
> been backported to pyro as commit d9456782 and I've confirmed that I
> have the same issue on pyro. On pyro in particular this is a
> regression as the patch was backported after pyro was released.
>
> The important change is:
>
>     -QB_CPU_x86 = "-cpu qemu32"
>     +QB_CPU_x86 = "-cpu pentium2"
>

We use -march=i586 for qemux86 which actually maps to pentium not
pentium2 which is i686 I think, this should be corrected to be with the
spirit of the patch. From gcc speak i586 means Intel Pentium CPU with
no MMX support.
and pentium2 means Intel Pentium II CPU, based on Pentium Pro core
with MMX instruction set support, I am assuming qemu means same.

> So my guess was that the go toolchain isn't limiting itself to the
> instructions supported by pentium2.
>
> To fix things I've added the following line to meta/classes/go.bbclass
> and meta/recipes-devtools/go/go-common.inc:
>
>     export GO386 = "387"
>
> As documented in https://golang.org/doc/install/source, this ensures
> that sse2 instructions aren't used. This fixes the issue and I now
> have working go binaries on qemux86 :)
>
> So my question is: should we just set GO386 = "387" so that it applies
> to all go binaries and accept the slight loss of performance on x86
> systems that do support sse2 instructions? Or should we make this
> MACHINE specific so that sse2 instructions can be used where
> supported?
>

We should have goarch set correctly, since i586 really did not have
sse2, we need this mapping based on -march added in go recipes
much like arm

> Whatever we do will need backporting to pyro as well.
>
> Cheers,
>
> --
> Paul Barker
> Togán Labs Ltd
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core at lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core



More information about the Openembedded-core mailing list