You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
--- a/src/cmd/link/internal/ld/data.go
+++ b/src/cmd/link/internal/ld/data.go
@@ -544,7 +544,14 @@ func relocsym(ctxt *Link, s *Symbol) {
o = Symaddr(r.Sym) + r.Add - int64(r.Sym.Sect.Vaddr)
case obj.R_ADDROFF:
- o = Symaddr(r.Sym) - int64(r.Sym.Sect.Vaddr) + r.Add
+ // The method offset tables using this relocation expect the offset to be relative
+ // to the start of the first text section, even if there are multiple.
+
+ if r.Sym.Sect.Name == ".text" {
+ o = Symaddr(r.Sym) - int64(Segtext.Vaddr) + r.Add
+ } else {
+ o = Symaddr(r.Sym) - int64(r.Sym.Sect.Vaddr) + r.Add
+ }
// r->sym can be null when CALL $(constant) is transformed from absolute PC to relative PC call.
case obj.R_CALL, obj.R_GOTPCREL, obj.R_PCREL:
Shouldn't we use Segtext.Vaddr rather be Segtext.Sect.Vaddr?
Segtext.Vaddr is the address of the text segment, while Segtext.Sect.Vaddr is the address the first section in the text segment (runtime.text), which is expected here.
The difference in addresses is due to alignment. cmd/link/internal/amd64/obj.go sets FlagTextAddr to a value that is aligned to an 8 byte boundary, but evidently some symbol in the text section wants to be aligned to a 16 byte boundary.
Since CL 27790, the build is broken on plan9/amd64.
See https://build.golang.org/log/4ca47ecfe2249b3368d4488118da1dd4ca9850ec
The issue is related to this specific change:
CC @ianlancetaylor
The text was updated successfully, but these errors were encountered: