From 29c600bba1279d63a40bc99a7e6212d3f0bffa06 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Wed, 12 Oct 2016 14:24:39 +0200 Subject: [PATCH] cmd/link: fix build on plan9/amd64 Support for multiple text sections was added in CL 27790. However, this change broke the build on plan9/amd64. In relocsym, the R_ADDROFF relocation was changed to use offsets relative to the start of the first text section. However, Segtext.Vaddr is the address of the text segment, while we expect to start from the first section (text.runtime) of the text segment. Fixes #17411. Change-Id: I86bbcbda81cea735b0ecf156eab2e6e5d63acce3 Reviewed-on: https://go-review.googlesource.com/30911 Run-TryBot: David du Colombier <0intro@gmail.com> Reviewed-by: Ian Lance Taylor --- src/cmd/link/internal/ld/data.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmd/link/internal/ld/data.go b/src/cmd/link/internal/ld/data.go index 3b4ca5b6a7..e7cb2523d1 100644 --- a/src/cmd/link/internal/ld/data.go +++ b/src/cmd/link/internal/ld/data.go @@ -591,7 +591,7 @@ func relocsym(ctxt *Link, s *Symbol) { // 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 + o = Symaddr(r.Sym) - int64(Segtext.Sect.Vaddr) + r.Add } else { o = Symaddr(r.Sym) - int64(r.Sym.Sect.Vaddr) + r.Add }