]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: don't cast end address to int32
authorCherry Mui <cherryyz@google.com>
Wed, 12 May 2021 02:40:02 +0000 (22:40 -0400)
committerCherry Mui <cherryyz@google.com>
Wed, 12 May 2021 15:04:42 +0000 (15:04 +0000)
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>

src/cmd/link/internal/ld/elf.go
src/cmd/link/internal/ld/macho.go

index 87d88dd957de9e564e8072fe135a5b2adfea1b9f..6f81e74da29ec8cf6f6158b59e59da12f6a8a870 100644 (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
index 642113cf0709604f3030cc3d0d4009bd57a0e63b..45a3971c33f5463ffc52094baedde2aa5e40696e 100644 (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