Illegal instruction when cross compiling for armv5

Bug #1564518 reported by David Lechner
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
golang-1.6 (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

I installed the golang-1.6 package for trusty and tried to cross-compile a trivial hello world program for armv5

    GOOS=linux GOARCH=arm GOARM=5 go build hello.go

When running the program on an actual arm machine though, the resulting hello executable crashes with "Illegal Instruction".

This same command with the official golang 1.6 Linux binary from the go website creates a working executable, so I am guessing that there is some compile option that is different in Ubuntu and that it probably has to to with floating points. armv5 should be using soft float instead of VFP.

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Can you provide some more details?

 * Source of hello.go (although I can probably guess this one :-)
 * Output of "GOOS=linux GOARCH=arm GOARM=5 go build -x hello.go" for the packaged go and the official go
 * Binaries produced by the two above commands

I don't have access to any armv5 hw but I'll see what I can do.

Revision history for this message
David Lechner (dlech) wrote :
Revision history for this message
David Lechner (dlech) wrote :
Revision history for this message
David Lechner (dlech) wrote :
Revision history for this message
David Lechner (dlech) wrote :
Revision history for this message
David Lechner (dlech) wrote :
Revision history for this message
David Lechner (dlech) wrote :
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Um, those binaries contain all but identical code (exactly one instruction differs, I think because the GOROOTs are different). Both appear to be built to use soft float (i.e. armv5 compatible). Are you sure the one from comment #4 crashes and the one from bomment #6 does not? Because I'm afraid I don't see how that is possible.

Revision history for this message
David Lechner (dlech) wrote :

Sorry for not double-checking. I just assumed the binary would still be broken. I think I figured out part of the issue though. The difference between my first attempt with the Ubuntu golang-1.6 package and the results that I posted here is that I installed the gcc-multilib package. This removed and replaced the existing cross-compiler package I had installed e.g. gcc-arm-linux-gnueabihf.

Apparently I had a bad combination of some cross compiler package and golang-1.6. I had a look at my dpkg.log to see what changed and it was quite a bit to sort through. I don't know that it is worth the time to try to figure out how to roll back the changes to try to reproduced the problem again. Hopefully this information will be useful if anyone else comes across the same problem though.

Changed in golang-1.6 (Ubuntu):
status: New → Incomplete
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Heh no worries, I've had some issues in that area as well.

Changed in golang-1.6 (Ubuntu):
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.