From: Cherry Mui Date: Fri, 8 Oct 2021 17:10:08 +0000 (-0400) Subject: cmd/link: put gcprog symbols along with gcbits X-Git-Tag: go1.18beta1~968 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=d480b5c790196c615213f2308d6b7b975eb99ff9;p=gostls13.git cmd/link: put gcprog symbols along with gcbits A stack object record may refer to the object's type's GC mask or GC program (for very large types). For the latter, currently the GC program symbol is named "type..gcprog.XXX" which is then laid out along with type symbols at link time. When relro is used, the type symbols end up in a different section. As we now use relative addressing for stack object records to refer to GC masks or GC programs, it is important that it is laid out in the rodata section (not rodata.rel.ro). Move GC program symbols to be along with GC masks, as they are similar and accessed the same way. They don't have relocations so they don't need to be laid to a relro section. This fixes flaky failures like https://build.golang.org/log/3bdbaaf786ec831b4393a64a959d2130edb5e050 Change-Id: I97aeac1234869da5b0f3a73a3010513d6a3156c6 Reviewed-on: https://go-review.googlesource.com/c/go/+/354793 Trust: Cherry Mui Trust: Josh Bleecher Snyder Run-TryBot: Cherry Mui TryBot-Result: Go Bot Reviewed-by: Josh Bleecher Snyder --- diff --git a/src/cmd/link/internal/ld/symtab.go b/src/cmd/link/internal/ld/symtab.go index 4be2634f44..7b1a0b7d1a 100644 --- a/src/cmd/link/internal/ld/symtab.go +++ b/src/cmd/link/internal/ld/symtab.go @@ -539,7 +539,8 @@ func (ctxt *Link) symtab(pcln *pclntab) []sym.SymKind { ldr.SetAttrNotInSymbolTable(s, true) ldr.SetCarrierSym(s, symgostring) - case strings.HasPrefix(name, "runtime.gcbits."): + case strings.HasPrefix(name, "runtime.gcbits."), + strings.HasPrefix(name, "type..gcprog."): symGroupType[s] = sym.SGCBITS ldr.SetAttrNotInSymbolTable(s, true) ldr.SetCarrierSym(s, symgcbits)