1
0
mirror of https://github.com/golang/go synced 2024-11-17 23:14:49 -07:00

[dev.link] cmd/link: remove special dynlinkingGo case in pclntab pass

Now that we removed the "weird thing" about runtime.etext symbol,
we can remove this special case.

Change-Id: I2e4558367758d37e898a802bcd30671c7dd6fe89
Reviewed-on: https://go-review.googlesource.com/c/go/+/240066
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-06-25 22:38:14 -04:00
parent a9a1217112
commit 7dbd40babf

View File

@ -324,16 +324,12 @@ func (ctxt *Link) pclntab() loader.Bitmap {
}
setAddr := (*loader.SymbolBuilder).SetAddrPlus
if ctxt.IsExe() && ctxt.IsInternal() && !ctxt.DynlinkingGo() {
if ctxt.IsExe() && ctxt.IsInternal() {
// Internal linking static executable. At this point the function
// addresses are known, so we can just use them instead of emitting
// relocations.
// For other cases we are generating a relocatable binary so we
// still need to emit relocations.
//
// Also not do this optimization when using plugins (DynlinkingGo),
// as on darwin it does weird things with runtime.etext symbol.
// TODO: remove the weird thing and remove this condition.
setAddr = func(s *loader.SymbolBuilder, arch *sys.Arch, off int64, tgt loader.Sym, add int64) int64 {
if v := ldr.SymValue(tgt); v != 0 {
return s.SetUint(arch, off, uint64(v+add))