]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: put gcprog symbols along with gcbits
authorCherry Mui <cherryyz@google.com>
Fri, 8 Oct 2021 17:10:08 +0000 (13:10 -0400)
committerCherry Mui <cherryyz@google.com>
Fri, 8 Oct 2021 18:07:25 +0000 (18:07 +0000)
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 <cherryyz@google.com>
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
src/cmd/link/internal/ld/symtab.go

index 4be2634f44934663461cedef500a09a32f8a21a2..7b1a0b7d1ace8bb93286734e557338f72c5977d7 100644 (file)
@@ -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)