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
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@cherrymui
Copy link
Member

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
Member Author

Fixed by the CL above.

@cherrymui
Copy link
Member Author

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

@gopherbot
Copy link

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.

@gopherbot
Copy link

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

@gopherbot
Copy link

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

@dmitshur dmitshur added the NeedsFix The path to resolution is known, but the work has not been done. label May 20, 2021
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
@golang golang locked and limited conversation to collaborators May 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants