[dev.link] cmd/link: remove some dependence on *Link

In an effort to make relocation application thread-safe remove another
dependence on context.

Change-Id: Ic53ea122cce72117fcebe56e386b710755f6eb68
Reviewed-on: https://go-review.googlesource.com/c/go/+/220838
Run-TryBot: Jeremy Faller <jeremy@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
This commit is contained in:
Jeremy Faller 2020-02-24 21:03:54 -05:00
parent e9056a6a73
commit d8b03c4678
5 changed files with 68 additions and 53 deletions

View file

@ -100,7 +100,7 @@ func trampoline(ctxt *Link, s *sym.Symbol) {
if Symaddr(r.Sym) == 0 && (r.Sym.Type != sym.SDYNIMPORT && r.Sym.Type != sym.SUNDEFEXT) {
if r.Sym.File != s.File {
if !isRuntimeDepPkg(s.File) || !isRuntimeDepPkg(r.Sym.File) {
ctxt.ErrorUnresolved(s, r)
ctxt.errorUnresolved(ctxt.Syms.ROLookup, s, r)
}
// runtime and its dependent packages may call to each other.
// they are fine, as they will be laid down together.
@ -167,7 +167,7 @@ func relocsym(ctxt *Link, target *Target, s *sym.Symbol) {
continue
}
} else {
ctxt.ErrorUnresolved(s, r)
ctxt.errorUnresolved(ctxt.Syms.ROLookup, s, r)
continue
}
}
@ -335,7 +335,7 @@ func relocsym(ctxt *Link, target *Target, s *sym.Symbol) {
// symbol which isn't in .data. However, as .text has the
// same address once loaded, this is possible.
if s.Sect.Seg == &Segdata {
Xcoffadddynrel(ctxt, s, r)
Xcoffadddynrel(target, s, r)
}
}