Skip to content

Commit

Permalink
cmd/internal/obj: build ctxt.Text during Sym init
Browse files Browse the repository at this point in the history
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 <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
  • Loading branch information
josharian committed Apr 13, 2017
1 parent 9dbba36 commit c18fd09
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/cmd/internal/obj/plist.go
Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down

0 comments on commit c18fd09

Please sign in to comment.