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: compiling with -dynlink on darwin/amd64 causes segfault #19701

Closed
josharian opened this issue Mar 24, 2017 · 2 comments
Closed

cmd/cgo: compiling with -dynlink on darwin/amd64 causes segfault #19701

josharian opened this issue Mar 24, 2017 · 2 comments

Comments

@josharian
Copy link
Contributor

I'm not sure whether this is supposed to work or not, but on darwin/amd64, this causes a segfault:

$ go build -a -gcflags="-dynlink" std cmd
go build runtime/cgo: /var/folders/1t/n61cbvls5bl293bbb0zyypqw0000gn/T/go-build113212789/cmd/cgo/_obj/exe/a.out: signal: segmentation fault

I encountered this while trying to manually test some compiler changes touching code protected by Ctxt.Flag_dynlink.

cc @ianlancetaylor @mwhudson

System details

go version devel darwin/amd64
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/josh"
GORACE=""
GOROOT="/Users/josh/go/tip"
GOTOOLDIR="/Users/josh/go/tip/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/1t/n61cbvls5bl293bbb0zyypqw0000gn/T/go-build732581054=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOROOT/bin/go version: go version devel darwin/amd64
GOROOT/bin/go tool compile -V: compile version devel X:framepointer
uname -v: Darwin Kernel Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
ProductName:	Mac OS X
ProductVersion:	10.12.3
BuildVersion:	16D32
lldb --version: lldb-360.1.70
@mwhudson
Copy link
Contributor

Um no, I wouldn't expect that to work, although that failure mode is a bit surprising (what is actually crashing here?)

@josharian
Copy link
Contributor Author

what is actually crashing here?

I think it's a binary compiled by a c compiler.

Anyway, if it's not expected to work, there's probably no bug here. Maybe a rejection from cmd/go would be useful, although it'd have to parse -gcflags, and really, who sets -gcflags=-dynlink but me? :)

Closing for now. Feel free to re-open if you see anything worth doing.

@golang golang locked and limited conversation to collaborators Mar 26, 2018
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

3 participants