Repository metrics
- Stars
- (133,883 stars)
- PR merge metrics
- (No merged PRs in 30d)
Description
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (go version)?
go version devel +c2a8d5972f Sat Sep 22 10:58:54 2018 +0200 linux/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env)?
GOARCH="amd64" GOBIN="" GOCACHE="/home/elias/.cache/go-build" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOOS="linux" GOPATH="/home/elias/dev/go" GOPROXY="" GORACE="" GOROOT="/home/elias/dev/go-release" GOTMPDIR="" GOTOOLDIR="/home/elias/dev/go-release/pkg/tool/linux_amd64" GCCGO="gccgo" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build186016377=/tmp/go-build -gno-record-gcc-switches"
What did you do?
$ cat test.go
package main
/*
__attribute__ ((visibility ("hidden"))) void some_c_func() {
}
*/
import "C"
func main() {
C.some_c_func()
}
$ go build test.go
$ objdump -t test|grep some_c_func
What did you expect to see?
All cgo wrappers for some_c_func marked local.
What did you see instead?
00000000006bd160 l O .data 0000000000000008 main._cgo_1622f853b35c_Cfunc_some_c_func
000000000044fb20 l F .text 0000000000000052 main._Cfunc_some_c_func
000000000044fc10 l F .text 0000000000000001 some_c_func
000000000044fc20 g F .text 0000000000000001 _cgo_1622f853b35c_Cfunc_some_c_func
The _cgo_1622f853b35c_Cfunc_some_c_func function is global, not local as I would expect. I would expect it to be local even if some_c_func itself is not.