1
0
mirror of https://github.com/golang/go synced 2024-11-20 08:54:40 -07:00

cmd/link: don't generate runtime.text twice for buildmode=plugin on darwin

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>
This commit is contained in:
Hiroshi Ioka 2017-09-11 07:51:57 +09:00 committed by David Crawshaw
parent e27a81221f
commit f797e485e0

View File

@ -1939,8 +1939,13 @@ func genasmsym(ctxt *Link, put func(*Link, *Symbol, string, SymbolType, int64, *
// skip STEXT symbols. Normal STEXT symbols are emitted by walking textp. // skip STEXT symbols. Normal STEXT symbols are emitted by walking textp.
s := ctxt.Syms.Lookup("runtime.text", 0) s := ctxt.Syms.Lookup("runtime.text", 0)
if s.Type == STEXT { if s.Type == STEXT {
// 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) put(ctxt, s, s.Name, TextSym, s.Value, nil)
} }
}
n := 0 n := 0
@ -1965,8 +1970,13 @@ func genasmsym(ctxt *Link, put func(*Link, *Symbol, string, SymbolType, int64, *
s = ctxt.Syms.Lookup("runtime.etext", 0) s = ctxt.Syms.Lookup("runtime.etext", 0)
if s.Type == STEXT { if s.Type == STEXT {
// 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) put(ctxt, s, s.Name, TextSym, s.Value, nil)
} }
}
for _, s := range ctxt.Syms.Allsym { for _, s := range ctxt.Syms.Allsym {
if s.Attr.NotInSymbolTable() { if s.Attr.NotInSymbolTable() {