]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.link] cmd/link: fix pclntab symbol handling on AIX
authorCherry Zhang <cherryyz@google.com>
Mon, 3 Aug 2020 21:59:41 +0000 (17:59 -0400)
committerCherry Zhang <cherryyz@google.com>
Mon, 3 Aug 2020 23:45:46 +0000 (23:45 +0000)
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>
src/cmd/link/internal/ld/data.go
src/cmd/link/internal/ld/pcln.go
src/cmd/link/internal/ld/xcoff.go

index 39f65364b71bf7bfec931eca36ccb09c1b527d91..b9e2408942bdabbfe48816ff388fde15d8fb0eab 100644 (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)) {
index 3b6f9d4bff1df32dde8cdec1f6afbe6b75631aab..936cfe28683d4d21180300f895bdef2dc8bbc548 100644 (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)
index 7eb7f94ca46b104a013d9961881177d26fca653d..7bf06eaa4614e0c8d433c794ce1f417b8b072243 100644 (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
        }
 }