-
Notifications
You must be signed in to change notification settings - Fork 18k
runtime: buildmode=c-shared segfaults on linux/arm (ARMv7) #12846
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
Comments
CC @mwhudson |
Can you try this on tip? |
@mwhudson What do you mean? |
I mean with a version of go built from current git, not the 1.5.1 release. I've changed some things around how c-shared works on ARM since the release and it would be interesting to know if they help. |
Oh I'm sorry, I forgot to switch the branch to Go 1.5. Should I close this issue and re-post? |
Are you saying your code succeeds with Go 1.5.1 but fails with Go top? Or the other way around? Or something else. No need for a new issue. |
The code does not succeeds with Go 1.5.1. I just tried the code on Go 1.5.1 because it is current release version. Now I test the code by using the latest master branch, the shared object
Thank you. |
I've run into the same issue with Go 1.5.1 on linux/arm, and my solution was to add: -installsuffix=blah to my "go build" command. Why that is required is a mystery to me, but it is required. (It's not required for linux/amd64 nor darwin/amd64, which we use extensively.) I bet iant@ knows why this is required as he added these flags to tests in "misc/cgo/testcshared", which is how I found out the solution to my woes. (It fails in "save_g" otherwise, trying to access the G pointer from TLS.) |
Using -installsuffix will force code to be recompiled. We may be a little confused about when it is needed with other options. If you still need to use it on tip, please open a different issue about that. |
What version of Go are you using (go version)?
% go version
go version go1.5.1 linux/arm
What operating system and processor architecture are you using?
% echo $GOOS/$GOARCH $GOARM
linux/arm 7
My machine is Rasberry Pi 2.
I tried to build a c-shared object on Raspberry Pi 2, based on the articles below.
Here is Go code exports
Sum
function.sum.go
And the following C code calls
Sum
function.main.c
To build a shared object, I execute the commands below.
Then I run
./a.out
, it segfaults.What did I something wrong? Thanks.
FYI,
buildmode=c-archive
also occurs an error.So
./sum.a
works fine when I passed gcc-pthread
option.However,
./sum.so
segfaults even though I passed gcc-pthread
.The text was updated successfully, but these errors were encountered: