go: cmd/link: panic: runtime error: slice bounds out of range [::1751306] with length 1048576
What version of Go are you using (go version
)?
$ go version $ go version go1.15.2 darwin/amd64
Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env 
What did you do?
$ go build -o xxx main.go
What did you expect to see?
build success
What did you see instead?
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 15 (8 by maintainers)
Commits related to this issue
- [release-branch.go1.15] cmd/internal/goobj2: fix buglet in object file reader The code in the Go object file reader was casting a pointer to mmaped memory into a large array prior to performing a rea... — committed to golang/go by thanm 4 years ago
- cmd/internal/goobj: add test case for object file reader Add test in which a input Go object file contains a very large number of relocations (more than 1<<20). Updates #41621. Change-Id: If1ebf3c4... — committed to golang/go by thanm 4 years ago
Would you be able to post instructions and/or source code so that we can reproduce this?
The panic is happening while the linker is reading relocations out of an object file – the offset it reads from the file is insane, which triggers the bounds range error. It would probably be a good idea to try to rule out the possibility of a corrupted object file (e.g. go clean -cache and rebuild).
Thanks @roger6106 . I will take a look.
@thanm: I just ran into this same issue. I have included reproducible code. Run
go generate
and thengo build
.golang-41621.zip
go env
Output