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

Support emulating arm64 go binaries with qemu #15050

Closed
luxas opened this issue Mar 31, 2016 · 13 comments
Closed

Support emulating arm64 go binaries with qemu #15050

luxas opened this issue Mar 31, 2016 · 13 comments

Comments

@luxas
Copy link

luxas commented Mar 31, 2016

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?
$ go version
go version go1.5.2 linux/amd64
  1. What operating system and processor architecture are you using (go env)?
$ go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/lucas/luxas/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GO15VENDOREXPERIMENT=""
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"
  1. What did you do?
    If possible, provide a recipe for reproducing the error.
    A complete runnable program is good.
    A link on play.golang.org is best.
$ cat > main.go <<EOF
package main

func main(){
    println("hello")
}
EOF
$ GOARCH=arm64 go build main.go
$ contrib/qemu-aarch64-static ./main
  1. What did you expect to see?
hello
  1. What did you see instead?
qemu: unhandled CPU exception 0x10004 - aborting
PC=00000000000636a8  SP=00000040007ffd60
X00=000000000000001e X01=0000000000000004 X02=00000000000d1180 X03=0000000000000000
X04=000001482000d200 X05=0000014820001080 X06=0000000000004000 X07=0000000000002000
X08=0000000000000087 X09=000000000000002c X10=00000000000004d2 X11=0000014820001080
X12=0000000000039ea0 X13=0000000000000000 X14=0000000000000000 X15=0000000000000180
X16=000000000002b150 X17=00000000000a6b88 X18=0000000000000000 X19=0000000000000000
X20=0000000000000000 X21=0000000000000000 X22=0000000000000000 X23=0000000000000000
X24=0000000000000000 X25=0000000000000000 X26=00000000000a6d98 X27=00000000000f256c
X28=00000000000d1280 X29=0000000000000000 X30=000000000001847c 
PSTATE=20000000 --C- EL0t
Aborted (core dumped)

I'm not sure if it's a go or qemu issue, but qemu works fine with other binaries.
This works for arm and ppc64le, but not arm64
Thanks!
/cc @rsc (this is Kubernetes related kubernetes/kubernetes#17981)

@minux
Copy link
Member

minux commented Mar 31, 2016 via email

@mwhudson
Copy link
Contributor

That said, we have made simple changes to Go to work around qemu issues in the past as well. More investigation required, basically.

@luxas
Copy link
Author

luxas commented Apr 6, 2016

Can you think about an easy way to fix?

@bradfitz bradfitz added this to the Unplanned milestone Apr 6, 2016
@mwhudson
Copy link
Contributor

mwhudson commented Apr 6, 2016

No. I asked a qemu maintainer and they said "I would say there is no immediate prospect of a fix". qemu-user is known to be bad with threads, although it works at least a bit with go binaries from other architectures.

@gopherbot
Copy link
Contributor

CL https://golang.org/cl/21599 mentions this issue.

@luxas
Copy link
Author

luxas commented Apr 20, 2016

@suihkulokki

@rsc
Copy link
Contributor

rsc commented Apr 20, 2016

Michael, did you test with qemu/arm64? Does it fix the problem? Thanks.

On Wed, Apr 20, 2016 at 1:00 PM Lucas Käldström [email protected]
wrote:

@suihkulokki https://github.com/suihkulokki


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#15050 (comment)

@mwhudson
Copy link
Contributor

No, I haven't tested anything.

@rsc
Copy link
Contributor

rsc commented Apr 21, 2016

Did anyone test this? If not, why did it reference this bug? Was it clear
from the qemu crash registers that the problem was the CPU count?

On Wed, Apr 20, 2016 at 6:40 PM Michael Hudson-Doyle <
[email protected]> wrote:

No, I haven't tested anything.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#15050 (comment)

@mwhudson
Copy link
Contributor

Oh sorry! Referencing this bug from that CL was simply a mistake (fixed before that CL was submitted).

@suihkulokki
Copy link

We've just merged major threading and signals rework has been into Qemu HEAD. From a quick check, running at least the @mwhudson hello world example works now.

@quentinmit
Copy link
Contributor

Excellent. @luxas Would you be able to check if this works now with Qemu HEAD?

@quentinmit
Copy link
Contributor

I'm going to close this bug for now; please comment if there are still problems with Qemu HEAD. Thanks!

@golang golang locked and limited conversation to collaborators Jun 30, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants