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

cmd/cgo: bad instructions in gcc_arm.S #17595

Closed
terrylai opened this issue Oct 26, 2016 · 5 comments

Comments

@terrylai
Copy link

commented Oct 26, 2016

Hello all,

My go version is 1.7.1.

My env variable is listed in the following:
export GOROOT=~/go
export GOOS=linux
export GOARCH=arm
export CC=/usr/local/arm-linux/bin/gcc
export CXX=/usr/local/arm-linux/bin/g++
export GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
build829110422=/tmp/go-build -gno-record-gcc-switches"
export CGO_ENABLED=1

I wanted to cross compile a go program but the following was returned:

go build
:
:

runtime/cgo

../../go/src/runtime/cgo/gcc_arm.S: Assembler messages:
../../go/src/runtime/cgo/gcc_arm.S:27: Error: bad instruction push {r4,r5,r6,r7,r8,r9,r10,r11,ip,lr}' ../../go/src/runtime/cgo/gcc_arm.S:37: Error: bad instructionpop {r4,r5,r6,r7,r8,r9,r10,r11,ip,pc}'

I checked the ../../go/src/runtime/cgo/gcc_arm.S file and it does exist but why it contains bad instructions?

BR,
Terry

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Oct 26, 2016

What compiler and assembler do you have installed (cc --version, as --version)?

Show us the output of go build -x.

@ianlancetaylor ianlancetaylor added this to the Go1.8 milestone Oct 26, 2016

@terrylai

This comment has been minimized.

Copy link
Author

commented Oct 26, 2016

ubuntu@ubuntu:~$ /usr/local/arm-linux/bin/gcc --version
gcc (GCC) 3.2.1

ubuntu@ubuntu:~$ /usr/local/arm-linux/bin/as --version
GNU assembler 2.13.2

go build -x can build successfully. But the file output is of type x86, not arm.

@minux

This comment has been minimized.

Copy link
Member

commented Oct 26, 2016

@minux

This comment has been minimized.

Copy link
Member

commented Oct 26, 2016

@josharian josharian changed the title Bad instructions in gcc_arm.S cmd/cgo: bad instructions in gcc_arm.S Oct 31, 2016

@rsc

This comment has been minimized.

Copy link
Contributor

commented Nov 2, 2016

We believe gcc 4.x will fix this. If not, please file a new issue. Thanks.

@rsc rsc closed this Nov 2, 2016

@golang golang locked and limited conversation to collaborators Nov 2, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
6 participants
You can’t perform that action at this time.