cmd/link/internal: thread *ld.Link through calls

Ctxt is a global defined in cmd/link/internal/ld of type *ld.Link.
Start threading a *ld.Link through function calls instead of
relying on the global variable.

Ctxt is still used as a global by the architecture-specific packages,
but I plan to fix that in a subsequent CL.

Change-Id: I77a3a58bd396fafd959fa1d8b1c83008a9f5a7fb
Reviewed-on: https://go-review.googlesource.com/27408
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
This commit is contained in:
Michael Matloob 2016-08-19 22:40:38 -04:00
parent 4b17b152a3
commit 2f783c3458
32 changed files with 1751 additions and 1737 deletions

View file

@ -118,7 +118,7 @@ func addlibpath(ctxt *Link, srcref string, objref string, file string, pkg strin
if shlibnamefile != "" {
shlibbytes, err := ioutil.ReadFile(shlibnamefile)
if err != nil {
Diag("cannot read %s: %v", shlibnamefile, err)
ctxt.Diag("cannot read %s: %v", shlibnamefile, err)
}
l.Shlib = strings.TrimSpace(string(shlibbytes))
}