Skip to content

Commit af0f8c1

Browse files
committed
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 <[email protected]> Run-TryBot: Cherry Mui <[email protected]> Reviewed-by: Than McIntosh <[email protected]> TryBot-Result: Go Bot <[email protected]>
1 parent 485474d commit af0f8c1

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1171,7 +1171,7 @@ func elfrelocsect(ctxt *Link, out *OutBuf, sect *sym.Section, syms []loader.Sym)
11711171
}
11721172
}
11731173

1174-
eaddr := int32(sect.Vaddr + sect.Length)
1174+
eaddr := sect.Vaddr + sect.Length
11751175
for _, s := range syms {
11761176
if !ldr.AttrReachable(s) {
11771177
continue

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1194,7 +1194,7 @@ func machorelocsect(ctxt *Link, out *OutBuf, sect *sym.Section, syms []loader.Sy
11941194
}
11951195
}
11961196

1197-
eaddr := int32(sect.Vaddr + sect.Length)
1197+
eaddr := sect.Vaddr + sect.Length
11981198
for _, s := range syms {
11991199
if !ldr.AttrReachable(s) {
12001200
continue

0 commit comments

Comments
 (0)