1
0
mirror of https://github.com/golang/go synced 2024-11-14 13:20:30 -07:00

[release-branch.go1.15] cmd/link: don't cast end address to int32

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 af0f8c149e)
Reviewed-on: https://go-review.googlesource.com/c/go/+/319370
This commit is contained in:
Cherry Mui 2021-05-11 22:40:02 -04:00 committed by Dmitri Shuralyov
parent 9636878913
commit 3380b180c6
2 changed files with 2 additions and 2 deletions

View File

@ -1400,7 +1400,7 @@ func elfrelocsect(ctxt *Link, sect *sym.Section, syms []*sym.Symbol) {
}
ldr := ctxt.loader
eaddr := int32(sect.Vaddr + sect.Length)
eaddr := sect.Vaddr + sect.Length
for _, s := range syms {
if !s.Attr.Reachable() {
continue

View File

@ -1044,7 +1044,7 @@ func machorelocsect(ctxt *Link, sect *sym.Section, syms []*sym.Symbol) {
}
}
eaddr := int32(sect.Vaddr + sect.Length)
eaddr := sect.Vaddr + sect.Length
for _, s := range syms {
if !s.Attr.Reachable() {
continue