-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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/link: panic: runtime error: slice bounds out of range [::1751306] with length 1048576 #41621
Comments
@w01fb0ss please do not post screenshots of text, please just copy and paste the text. Thank you |
$ go env What did you see instead? command-line-argumentspanic: runtime error: slice bounds out of range [::1751306] with length 1048576 goroutine 1 [running]: |
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). |
@thanm: I just ran into this same issue. I have included reproducible code. Run $ go version go version go1.15.6 darwin/amd64
|
Thanks @roger6106 . I will take a look. |
I can reproduce this on tip; working on a fix. |
Change https://golang.org/cl/278492 mentions this issue: |
Change https://golang.org/cl/278493 mentions this issue: |
@gopherbot please consider this for backport to 1.15 |
Backport issue(s) opened: #43214 (for 1.15). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://golang.org/wiki/MinorReleases. |
Change https://golang.org/cl/278673 mentions this issue: |
…e reader The code in the Go object file reader was casting a pointer to mmaped memory into a large array prior to performing a read of the relocations section: return (*[1<<20]Reloc)(unsafe.Pointer(&r.b[off]))[:n:n] For very large object files, this artificial array isn't large enough (that is, there are more than 1048576 relocs to read), so update the code to use a larger artifical array size. Fixes #43214. Updates #41621. Change-Id: Ic047c8aef4f8a3839f2e7e3594bce652ebd6bd5b Reviewed-on: https://go-review.googlesource.com/c/go/+/278492 Run-TryBot: Than McIntosh <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Cherry Zhang <[email protected]> Reviewed-by: Jeremy Faller <[email protected]> Trust: Than McIntosh <[email protected]> (cherry picked from commit f4e7a6b) Reviewed-on: https://go-review.googlesource.com/c/go/+/278673
Add test in which a input Go object file contains a very large number of relocations (more than 1<<20). Updates #41621. Change-Id: If1ebf3c4fefbf55ddec4e05c5299e7c48fc697d8 Reviewed-on: https://go-review.googlesource.com/c/go/+/278493 Run-TryBot: Than McIntosh <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Cherry Zhang <[email protected]> Trust: Than McIntosh <[email protected]>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
$ go build -o xxx main.go
What did you expect to see?
build success
What did you see instead?
The text was updated successfully, but these errors were encountered: