Skip to content

Commit ab4a71f

Browse files
committed
[dev.link] cmd/link: use the start of compilation unit for R_ADDRCUOFF
R_ADDRCUOFF refers to the offset from the start of the compilation unit. Now that we could have multiple compilation units per package, we should use the start of the compilation unit, instead of the start of the package. Change-Id: I3d6a3c5a5c47c9ccf88091ed05413ced826f9934 Reviewed-on: https://go-review.googlesource.com/c/go/+/204828 Run-TryBot: Cherry Zhang <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Than McIntosh <[email protected]>
1 parent 4497d7e commit ab4a71f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ func relocsym(ctxt *Link, s *sym.Symbol) {
402402
case objabi.R_ADDRCUOFF:
403403
// debug_range and debug_loc elements use this relocation type to get an
404404
// offset from the start of the compile unit.
405-
o = Symaddr(r.Sym) + r.Add - Symaddr(r.Sym.Unit.Lib.Textp[0])
405+
o = Symaddr(r.Sym) + r.Add - Symaddr(r.Sym.Unit.Textp[0])
406406

407407
// r->sym can be null when CALL $(constant) is transformed from absolute PC to relative PC call.
408408
case objabi.R_GOTPCREL:

0 commit comments

Comments
 (0)