1
0
mirror of https://github.com/golang/go synced 2024-11-17 21:54:49 -07:00

[dev.link] cmd/link: fix pclntab symbol handling on AIX

On AIX, container symbols are handled in a weird way (unlike
other platforms): the outer symbol needs to have size (but still
no data), and the inner symbols must not be in the symbol table
(otherwise it overlaps with the outer symbol, which the system
linker doesn't like).

As of CL 241598, pclntab becomes a container symbol. We need to
follow the rule above for AIX.

Fix AIX build.

Change-Id: Ie2515a4cabbd8cf3f6d3868643a28f64ca3365a2
Reviewed-on: https://go-review.googlesource.com/c/go/+/246479
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
This commit is contained in:
Cherry Zhang 2020-08-03 17:59:41 -04:00
parent 5c9b540378
commit b85033d153
3 changed files with 7 additions and 0 deletions

View File

@ -1925,6 +1925,9 @@ func (state *dodataState) allocateDataSections(ctxt *Link) {
ldr.SetSymSect(ldr.LookupOrCreateSym("runtime.funcnametab", 0), sect)
ldr.SetSymSect(ldr.LookupOrCreateSym("runtime.pclntab_old", 0), sect)
ldr.SetSymSect(ldr.LookupOrCreateSym("runtime.epclntab", 0), sect)
if ctxt.HeadType == objabi.Haix {
xcoffUpdateOuterSize(ctxt, int64(sect.Length), sym.SPCLNTAB)
}
// 6g uses 4-byte relocation offsets, so the entire segment must fit in 32 bits.
if state.datsize != int64(uint32(state.datsize)) {

View File

@ -78,6 +78,7 @@ func (state *pclntab) addGeneratedSym(ctxt *Link, name string, size int64, f gen
s := ctxt.createGeneratorSymbol(name, 0, sym.SPCLNTAB, size, f)
ctxt.loader.SetAttrReachable(s, true)
ctxt.loader.SetCarrierSym(s, state.carrier)
ctxt.loader.SetAttrNotInSymbolTable(s, true)
return s
}
@ -455,6 +456,7 @@ func (ctxt *Link) pclntab(container loader.Bitmap) *pclntab {
funcdataBytes := int64(0)
ldr.SetCarrierSym(state.pclntab, state.carrier)
ldr.SetAttrNotInSymbolTable(state.pclntab, true)
ftab := ldr.MakeSymbolUpdater(state.pclntab)
ftab.SetValue(state.size)
ftab.SetType(sym.SPCLNTAB)

View File

@ -605,6 +605,8 @@ func xcoffUpdateOuterSize(ctxt *Link, size int64, stype sym.SymKind) {
outerSymSize["go.funcrel.*"] = size
case sym.SGCBITS:
outerSymSize["runtime.gcbits.*"] = size
case sym.SPCLNTAB:
outerSymSize["runtime.pclntab"] = size
}
}