1
0
mirror of https://github.com/golang/go synced 2024-11-18 15:34:53 -07:00

[dev.link] cmd/link: convert textbuildid pass to new style

Change-Id: Ic3a7bfc8b0290bd7bdc71e64cab74788328c41d1
Reviewed-on: https://go-review.googlesource.com/c/go/+/225657
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
This commit is contained in:
Cherry Zhang 2020-03-26 12:54:21 -04:00
parent 6652a6cccc
commit c5f6920212
2 changed files with 13 additions and 10 deletions

View File

@ -2011,18 +2011,19 @@ func (ctxt *Link) textbuildid() {
return
}
s := ctxt.Syms.Lookup("go.buildid", 0)
s.Attr |= sym.AttrReachable
ldr := ctxt.loader
s := ldr.CreateSymForUpdate("go.buildid", 0)
s.SetReachable(true)
// The \xff is invalid UTF-8, meant to make it less likely
// to find one of these accidentally.
data := "\xff Go build ID: " + strconv.Quote(*flagBuildid) + "\n \xff"
s.Type = sym.STEXT
s.P = []byte(data)
s.Size = int64(len(s.P))
s.SetType(sym.STEXT)
s.SetData([]byte(data))
s.SetSize(int64(len(data)))
ctxt.Textp = append(ctxt.Textp, nil)
copy(ctxt.Textp[1:], ctxt.Textp)
ctxt.Textp[0] = s
ctxt.Textp2 = append(ctxt.Textp2, 0)
copy(ctxt.Textp2[1:], ctxt.Textp2)
ctxt.Textp2[0] = s.Sym()
}
func (ctxt *Link) buildinfo() {

View File

@ -276,6 +276,10 @@ func Main(arch *sys.Arch, theArch Arch) {
bench.Start("doxcoff")
ctxt.doxcoff()
}
bench.Start("textbuildid")
ctxt.textbuildid()
bench.Start("loadlibfull")
setupdynexp(ctxt)
ctxt.loadlibfull() // XXX do it here for now
@ -289,8 +293,6 @@ func Main(arch *sys.Arch, theArch Arch) {
ctxt.addexport()
bench.Start("Gentext")
thearch.Gentext(ctxt) // trampolines, call stubs, etc.
bench.Start("textbuildid")
ctxt.textbuildid()
bench.Start("textaddress")
ctxt.textaddress()
bench.Start("pclntab")