]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: don't generate runtime.text twice for buildmode=plugin on darwin
authorHiroshi Ioka <hirochachacha@gmail.com>
Sun, 10 Sep 2017 22:51:57 +0000 (07:51 +0900)
committerDavid Crawshaw <crawshaw@golang.org>
Mon, 11 Sep 2017 02:30:05 +0000 (02:30 +0000)
https://golang.org/cl/29394 changed to include runtime.text and
runtime.etext in ctxt.Textp as a work around.
But it seems that the CL forgot to change genasmsym.
As a result, we are generating runtime.text and runtime.etext twice.

Change-Id: If7f8faf496c1c489ffa4804da712f91a3d3f4be4
Reviewed-on: https://go-review.googlesource.com/62810
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/link/internal/ld/lib.go

index 14821d82710fedbdbe1f15197fd99976a46aba0c..47c719b7b60d6f10c7bd55eca34f3a9bfd5d4846 100644 (file)
@@ -1939,7 +1939,12 @@ func genasmsym(ctxt *Link, put func(*Link, *Symbol, string, SymbolType, int64, *
        // skip STEXT symbols. Normal STEXT symbols are emitted by walking textp.
        s := ctxt.Syms.Lookup("runtime.text", 0)
        if s.Type == STEXT {
-               put(ctxt, s, s.Name, TextSym, s.Value, nil)
+               // We've already included this symbol in ctxt.Textp
+               // if ctxt.DynlinkingGo() && Headtype == objabi.Hdarwin.
+               // See data.go:/textaddress
+               if !(ctxt.DynlinkingGo() && Headtype == objabi.Hdarwin) {
+                       put(ctxt, s, s.Name, TextSym, s.Value, nil)
+               }
        }
 
        n := 0
@@ -1965,7 +1970,12 @@ func genasmsym(ctxt *Link, put func(*Link, *Symbol, string, SymbolType, int64, *
 
        s = ctxt.Syms.Lookup("runtime.etext", 0)
        if s.Type == STEXT {
-               put(ctxt, s, s.Name, TextSym, s.Value, nil)
+               // We've already included this symbol in ctxt.Textp
+               // if ctxt.DynlinkingGo() && Headtype == objabi.Hdarwin.
+               // See data.go:/textaddress
+               if !(ctxt.DynlinkingGo() && Headtype == objabi.Hdarwin) {
+                       put(ctxt, s, s.Name, TextSym, s.Value, nil)
+               }
        }
 
        for _, s := range ctxt.Syms.Allsym {