From: Josh Bleecher Snyder Date: Thu, 13 Apr 2017 00:43:30 +0000 (-0700) Subject: cmd/internal/obj: build ctxt.Text during Sym init X-Git-Tag: go1.9beta1~711 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=c18fd098401805478fac6a3ff42bfad9a66a16d3;p=gostls13.git cmd/internal/obj: build ctxt.Text during Sym init Instead of constructing ctxt.Text in Flushplist, which will be called concurrently, do it in InitTextSym, which must be called serially. This allows us to avoid a mutex for ctxt.Text, and preserves the existing ordering of functions for debug output. Passes toolstash-check. Updates #15756 Change-Id: I6322b4da24f9f0db7ba25e5b1b50e8d3be2deb37 Reviewed-on: https://go-review.googlesource.com/40502 Run-TryBot: Josh Bleecher Snyder TryBot-Result: Gobot Gobot Reviewed-by: Matthew Dempsky --- diff --git a/src/cmd/internal/obj/plist.go b/src/cmd/internal/obj/plist.go index 069e954130..ebfd361021 100644 --- a/src/cmd/internal/obj/plist.go +++ b/src/cmd/internal/obj/plist.go @@ -107,9 +107,6 @@ func Flushplist(ctxt *Link, plist *Plist, newprog ProgAlloc) { linkpcln(ctxt, s) makeFuncDebugEntry(ctxt, plist.Curfn, s) } - - // Add to running list in ctxt. - ctxt.Text = append(ctxt.Text, text...) } func (ctxt *Link) InitTextSym(s *LSym, flag int) { @@ -135,6 +132,7 @@ func (ctxt *Link) InitTextSym(s *LSym, flag int) { s.Set(AttrNeedCtxt, flag&NEEDCTXT != 0) s.Set(AttrNoFrame, flag&NOFRAME != 0) s.Type = STEXT + ctxt.Text = append(ctxt.Text, s) } func (ctxt *Link) Globl(s *LSym, size int64, flag int) {