go: cmd/link: unexpected bindingNone in '_go.buildid'
After upgrading to Go 1.15, the linker fails on some packages with unexpected bindingNone in '_go.buildid'
. This only happens on Darwin but not Linux. We haven’t been able to construct the small example to reproduce the issue.
The issues seems to related to the size of the linked binary. For example, a test binary that fails to link in Go 1.15 is 330MB when it’s linked in Go 1.14.
Similar errors:
- https://forums.xamarin.com/discussion/comment/49320/#Comment_49320
- https://github.com/jmcmellen/splat/issues/3#issuecomment-454627284
What version of Go are you using (go version
)?
$ go version go version go1.15 darwin/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/Users/zplin/Library/Caches/go-build" GOENV="/Users/zplin/Library/Application Support/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOINSECURE="" GOMODCACHE="/Users/zplin/gocode/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="/Users/zplin/gocode" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/Cellar/go/1.15/libexec" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/Cellar/go/1.15/libexec/pkg/tool/darwin_amd64" GCCGO="gccgo" AR="ar" CC="clang" CXX="clang++" 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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/bf/3ympgpy92txgknkb4z30dldh0000gn/T/go-build303752340=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
Building some packages with either go build
or bazel build
What did you expect to see?
Build succeeds
What did you see instead?
Linker fails with the following error:
final section layout:
__TEXT/__text addr=0x04001E00, size=0x092B5F84, fileOffset=0x00001E00, type=1
__TEXT/__stubs addr=0x0D2B7D84, size=0x00000534, fileOffset=0x092B7D84, type=28
__TEXT/__stub_helper addr=0x0D2B82B8, size=0x000008BC, fileOffset=0x092B82B8, type=32
__TEXT/__rodata addr=0x0D2B8B80, size=0x02DE98D8, fileOffset=0x092B8B80, type=0
__TEXT/__typelink addr=0x100A2460, size=0x00054884, fileOffset=0x0C0A2460, type=0
__TEXT/__itablink addr=0x100F6CE8, size=0x0002F820, fileOffset=0x0C0F6CE8, type=0
__TEXT/__gosymtab addr=0x10126508, size=0x00000000, fileOffset=0x0C126508, type=0
__TEXT/__gopclntab addr=0x10126520, size=0x06EB5A95, fileOffset=0x0C126520, type=0
__TEXT/__cstring addr=0x16FDBFC0, size=0x000074AC, fileOffset=0x12FDBFC0, type=13
__TEXT/__const addr=0x16FE3470, size=0x000052A0, fileOffset=0x12FE3470, type=0
__TEXT/text_env addr=0x16FE8710, size=0x00003340, fileOffset=0x12FE8710, type=0
__TEXT/__unwind_info addr=0x16FEBA50, size=0x000015A0, fileOffset=0x12FEBA50, type=22
__DATA/__nl_symbol_ptr addr=0x16FED000, size=0x00000008, fileOffset=0x12FED000, type=29
__DATA/__got addr=0x16FED008, size=0x00000038, fileOffset=0x12FED008, type=29
__DATA/__la_symbol_ptr addr=0x16FED040, size=0x000006F0, fileOffset=0x12FED040, type=27
__DATA/__const addr=0x16FED730, size=0x000026A0, fileOffset=0x12FED730, type=0
__DATA/__go_buildinfo addr=0x16FEFDD0, size=0x00000020, fileOffset=0x12FEFDD0, type=0
__DATA/__noptrdata addr=0x16FEFE00, size=0x00092A60, fileOffset=0x12FEFE00, type=0
__DATA/__data addr=0x17082860, size=0x00036068, fileOffset=0x13082860, type=0
__DATA/__bss addr=0x170B88E0, size=0x000695F0, fileOffset=0x00000000, type=25
__DATA/__noptrbss addr=0x17121EE0, size=0x00022080, fileOffset=0x00000000, type=25
__DATA/__common addr=0x17143F60, size=0x00000010, fileOffset=0x00000000, type=25
ld: unexpected bindingNone in '_go.buildid' from /var/folders/6w/bx57vndx04l6w11tf912xzyc0000gn/T/go-link-018988157/go.o for architecture x86_64
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 35 (18 by maintainers)
Commits related to this issue
- cmd/link: recompute heapPos after copyHeap Immediately after a forward Seek, the offset we're writing to is beyond len(buf)+len(heap): |<--- buf --->|<--- heap --->| ... — committed to golang/go by cherrymui 4 years ago
- [release-branch.go1.15] cmd/link: recompute heapPos after copyHeap Immediately after a forward Seek, the offset we're writing to is beyond len(buf)+len(heap): |<--- buf --->|<--- heap --->| ... — committed to golang/go by cherrymui 4 years ago
Change https://golang.org/cl/270942 mentions this issue:
[release-branch.go1.15] cmd/link: recompute heapPos after copyHeap
@dmitshur this only applies to 1.15, we have not experienced the same for 1.14.
I read through https://github.com/golang/go/wiki/MinorReleases and tried to follow the process by having the bot create #42948.
With that I think the CherryPickCandidate/NeedsInvestigation labels can be removed from this issue and it can be resolved as b194b51 is in master.
Yeah, feel free to do whatever that makes your workflow easier.
I didn’t make this issue target Go 1.16 as it just doesn’t fail at Go 1.16. (CL 270941 is still nice to have.)
Using the same go build from cherry-picking https://golang.org/cl/270942 onto the 1.15.5 tag also works for the bazel project, so I’m fairly confident that must have been it.
I cherry-picked https://golang.org/cl/270942 onto the 1.15.5 tag and rebuild the failing project to verify and it seems this solves the issue for our go-build project.
Going to verify the bazel project too, but so far so good!