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

Paul Barker pbarker at toganlabs.com
Thu Oct 5 14:23:38 UTC 2017


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"

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?

Whatever we do will need backporting to pyro as well.

Cheers,

-- 
Paul Barker
Togán Labs Ltd



More information about the Openembedded-core mailing list