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/link: internal error when externally linking very large binaries #46126

Closed
cherrymui opened this issue May 12, 2021 · 5 comments
Closed

cmd/link: internal error when externally linking very large binaries #46126

cherrymui opened this issue May 12, 2021 · 5 comments
Labels
Milestone

Comments

@cherrymui
Copy link
Contributor

@cherrymui cherrymui commented May 12, 2021

What version of Go are you using (go version)?

tip (9b84814)

Does this issue reproduce with the latest release?

yes

What did you do?

At https://tip.golang.org/src/cmd/link/internal/ld/elf.go#L1174 the end address is truncated to int32. This is wrong. For very large binaries the end address may not fit into int32. This truncation will cause linker internal error.

CL https://go-review.googlesource.com/c/go/+/319289 fixes it.

Found in a Google internal program.

@cherrymui cherrymui added this to the Go1.17 milestone May 12, 2021
@cherrymui
Copy link
Contributor Author

@cherrymui cherrymui commented May 12, 2021

Fixed by the CL above.

Loading

@cherrymui cherrymui closed this May 12, 2021
@cherrymui
Copy link
Contributor Author

@cherrymui cherrymui commented May 12, 2021

@gopherbot please backport this. This is a build failure without easy workaround. Thanks.

Loading

@gopherbot
Copy link

@gopherbot gopherbot commented May 12, 2021

Backport issue(s) opened: #46127 (for 1.15), #46128 (for 1.16).

Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://golang.org/wiki/MinorReleases.

Loading

@gopherbot
Copy link

@gopherbot gopherbot commented May 12, 2021

Change https://golang.org/cl/319369 mentions this issue: [release-branch.go1.16] cmd/link: don't cast end address to int32

Loading

@gopherbot
Copy link

@gopherbot gopherbot commented May 12, 2021

Change https://golang.org/cl/319370 mentions this issue: [release-branch.go1.15] cmd/link: don't cast end address to int32

Loading

gopherbot pushed a commit that referenced this issue May 21, 2021
When linking a very large binary, the section address may not fit
in int32. Don't truncate it.

Fixes #46127.
Updates #46126.

Change-Id: Ibcc8d74bf5662611949e547ce44ca8b973de383f
Reviewed-on: https://go-review.googlesource.com/c/go/+/319289
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
(cherry picked from commit af0f8c1)
Reviewed-on: https://go-review.googlesource.com/c/go/+/319370
gopherbot pushed a commit that referenced this issue May 21, 2021
When linking a very large binary, the section address may not fit
in int32. Don't truncate it.

Fixes #46128.
Updates #46126.

Change-Id: Ibcc8d74bf5662611949e547ce44ca8b973de383f
Reviewed-on: https://go-review.googlesource.com/c/go/+/319289
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
(cherry picked from commit af0f8c1)
Reviewed-on: https://go-review.googlesource.com/c/go/+/319369
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants