1
0
mirror of https://github.com/golang/go synced 2024-11-18 12:04:57 -07:00

[dev.link] cmd/link: define _etext, etc. in the linker on Solaris

On Solaris, in the runtime it defines the external name of
runtime.etext as _etext (runtime/os3_solaris.go:13). In CL 224939
we changed to put external names in the ELF symbol table more
consistently. In this case it will contain _etext but not
runtime.etext.

To be conservative, this CL defines both runtime.etext and _text
in the linker.

Change-Id: I79f196e87b655042be97b0fbbab02d0ebc8db2fa
Reviewed-on: https://go-review.googlesource.com/c/go/+/225537
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
This commit is contained in:
Cherry Zhang 2020-03-25 17:10:16 -04:00
parent c4cb6832bb
commit ca18c37ee8

View File

@ -2419,6 +2419,24 @@ func (ctxt *Link) address() []*sym.Segment {
ctxt.xdefine("runtime.enoptrbss", sym.SNOPTRBSS, int64(noptrbss.Vaddr+noptrbss.Length))
ctxt.xdefine("runtime.end", sym.SBSS, int64(Segdata.Vaddr+Segdata.Length))
if ctxt.IsSolaris() {
// On Solaris, in the runtime it sets the external names of the
// end symbols. Unset them and define separate symbols, so we
// keep both.
etext := ctxt.Syms.ROLookup("runtime.etext", 0)
edata := ctxt.Syms.ROLookup("runtime.edata", 0)
end := ctxt.Syms.ROLookup("runtime.end", 0)
etext.SetExtname("runtime.etext")
edata.SetExtname("runtime.edata")
end.SetExtname("runtime.end")
ctxt.xdefine("_etext", etext.Type, etext.Value)
ctxt.xdefine("_edata", edata.Type, edata.Value)
ctxt.xdefine("_end", end.Type, end.Value)
ctxt.Syms.ROLookup("_etext", 0).Sect = etext.Sect
ctxt.Syms.ROLookup("_edata", 0).Sect = edata.Sect
ctxt.Syms.ROLookup("_end", 0).Sect = end.Sect
}
return order
}