From c18fd098401805478fac6a3ff42bfad9a66a16d3 Mon Sep 17 00:00:00 2001 From: Josh Bleecher Snyder Date: Wed, 12 Apr 2017 17:43:30 -0700 Subject: [PATCH] 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 --- src/cmd/internal/obj/plist.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) 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) { -- 2.50.0