]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.link] cmd/link: convert textbuildid pass to new style
authorCherry Zhang <cherryyz@google.com>
Thu, 26 Mar 2020 16:54:21 +0000 (12:54 -0400)
committerCherry Zhang <cherryyz@google.com>
Fri, 27 Mar 2020 00:06:28 +0000 (00:06 +0000)
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>
src/cmd/link/internal/ld/data.go
src/cmd/link/internal/ld/main.go

index 8c240f4d9078a1c3eceaec7097b2dec5f4f6c11c..c2ccb2790be138fa08e252ad79ddfa5e537402a8 100644 (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() {
index a94280dc0b2f52e6116f78a4e32685b8a36fadc3..82862d274eb9edfefdca4cf6db2dd08acd9f318a 100644 (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")