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.

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>
This commit is contained in:
Cherry Mui 2021-05-11 22:40:02 -04:00
parent 485474d204
commit af0f8c149e
2 changed files with 2 additions and 2 deletions

View file

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

View file

@ -1194,7 +1194,7 @@ func machorelocsect(ctxt *Link, out *OutBuf, sect *sym.Section, syms []loader.Sy
}
}
eaddr := int32(sect.Vaddr + sect.Length)
eaddr := sect.Vaddr + sect.Length
for _, s := range syms {
if !ldr.AttrReachable(s) {
continue