cmd/link: fix trampoline generation for aix/ppc64

This commit fixes trampoline generation on aix/ppc64 which must use TOC
symbols.
It also adds a size to runtime.text.X symbols to prevent ld from moving
them, like runtime.text.

Change-Id: Ida033ec20ad8d7b7fb3faeb0ec4fa7bc4ce86b7e
Reviewed-on: https://go-review.googlesource.com/c/go/+/164009
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Clément Chigot 2019-02-20 16:48:43 +01:00 committed by Ian Lance Taylor
parent d06704a3c2
commit cb8054a6b6
4 changed files with 95 additions and 33 deletions

View file

@ -2176,7 +2176,8 @@ func genasmsym(ctxt *Link, put func(*Link, *sym.Symbol, string, SymbolType, int6
n++
continue
}
if sect.Name != ".text" {
if sect.Name != ".text" || (ctxt.HeadType == objabi.Haix && ctxt.LinkMode == LinkExternal) {
// On AIX, runtime.text.X are symbols already in the symtab.
break
}
s = ctxt.Syms.ROLookup(fmt.Sprintf("runtime.text.%d", n), 0)