Skip to content

Commit 6dc250f

Browse files
Helflymianlancetaylor
authored andcommitted
cmd/link: fix the size of typerel.* with c-archive buildmode
With buildmode=c-archive, "runtime.types" type isn't STYPE but STYPERELRO. On AIX, this symbol is present in the symbol table and not under typerel.* outersymbol. Therefore, the size of typerel.* must be adapted. Fixes #35342 Change-Id: Ib982c6557d9b41bc3d8775e4825650897f9e0ee6 Reviewed-on: https://go-review.googlesource.com/c/go/+/205338 Run-TryBot: Ian Lance Taylor <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent 0c5d545 commit 6dc250f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/cmd/link/internal/ld/xcoff.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -578,13 +578,14 @@ func xcoffUpdateOuterSize(ctxt *Link, size int64, stype sym.SymKind) {
578578
// Nothing to do
579579
case sym.STYPERELRO:
580580
if ctxt.UseRelro() && (ctxt.BuildMode == BuildModeCArchive || ctxt.BuildMode == BuildModeCShared || ctxt.BuildMode == BuildModePIE) {
581-
outerSymSize["typerel.*"] = size
581+
// runtime.types size must be removed, as it's a real symbol.
582+
outerSymSize["typerel.*"] = size - ctxt.Syms.ROLookup("runtime.types", 0).Size
582583
return
583584
}
584585
fallthrough
585586
case sym.STYPE:
586587
if !ctxt.DynlinkingGo() {
587-
// runtime.types size must be removed.
588+
// runtime.types size must be removed, as it's a real symbol.
588589
outerSymSize["type.*"] = size - ctxt.Syms.ROLookup("runtime.types", 0).Size
589590
}
590591
case sym.SGOSTRING:

0 commit comments

Comments
 (0)