From: Lynn Boger Date: Wed, 7 Dec 2016 13:55:21 +0000 (-0600) Subject: cmd/link: fix sym sect when splitting text on ppc64le X-Git-Tag: go1.8beta2~70 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=6623988eb73da429f41cfef85d481a5b93446ccd;p=gostls13.git cmd/link: fix sym sect when splitting text on ppc64le While processing a symbol for a function, if it is determined that a function would make the text section too large then a new text section is created and the address of the function is in the new text section. But the symbol for the function is marked as being in the previous text section, causing incorrect codegen for the function and leading to a segv if that function is called. This adds code to set the sym.Sect field to the new section if a new one is created. Note that this problem only happens at the point where a new section is created. Fixes #18218 Change-Id: Ic21ae11368d9d88ff6d5d3977f9ea72fe6477ed1 Reviewed-on: https://go-review.googlesource.com/34069 Run-TryBot: Lynn Boger TryBot-Result: Gobot Gobot Reviewed-by: Carlos Eduardo Seo Reviewed-by: Ian Lance Taylor --- diff --git a/src/cmd/link/internal/ld/data.go b/src/cmd/link/internal/ld/data.go index ed8193294e..1e2a9eadc5 100644 --- a/src/cmd/link/internal/ld/data.go +++ b/src/cmd/link/internal/ld/data.go @@ -2114,6 +2114,7 @@ func assignAddress(ctxt *Link, sect *Section, n int, sym *Symbol, va uint64) (*S // Create new section, set the starting Vaddr sect = addsection(&Segtext, ".text", 05) sect.Vaddr = va + sym.Sect = sect // Create a symbol for the start of the secondary text sections ctxt.Syms.Lookup(fmt.Sprintf("runtime.text.%d", n), 0).Sect = sect