diff options
author | Josh Bleecher Snyder <josharian@gmail.com> | 2017-04-06 09:54:14 -0700 |
---|---|---|
committer | Josh Bleecher Snyder <josharian@gmail.com> | 2017-04-06 19:01:41 +0000 |
commit | c311488283fc9d9ad22e20a9b6551681af8586ef (patch) | |
tree | 874cdd36baa5ebf7efac786e97ba963f42e728fe /src/cmd/compile/internal | |
parent | 2c1888bf4804010213849521b96bd743d84dd34c (diff) | |
download | go-c311488283fc9d9ad22e20a9b6551681af8586ef.tar.gz go-c311488283fc9d9ad22e20a9b6551681af8586ef.zip |
cmd/internal/obj: remove Linklookup
It was simply a wrapper around Link.Lookup.
Unwrap everything.
CL prepared using eg with template:
package p
import "cmd/internal/obj"
func before(ctxt *obj.Link, name string, version int) *obj.LSym {
return obj.Linklookup(ctxt, name, version)
}
func after(ctxt *obj.Link, name string, version int) *obj.LSym {
return ctxt.Lookup(name, version)
}
Then one comment in cmd/asm/internal/asm/parse.go
was manually updated (and gofmt'ed!),
and func Linklookup deleted.
Passes toolstash-check (as a sanity measure).
Change-Id: Icc4d56b0b2b5c8888d3184c1898c48359ea1e638
Reviewed-on: https://go-review.googlesource.com/39715
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/cmd/compile/internal')
-rw-r--r-- | src/cmd/compile/internal/gc/obj.go | 4 | ||||
-rw-r--r-- | src/cmd/compile/internal/gc/pgen.go | 4 | ||||
-rw-r--r-- | src/cmd/compile/internal/gc/reflect.go | 12 | ||||
-rw-r--r-- | src/cmd/compile/internal/ssa/export_test.go | 2 | ||||
-rw-r--r-- | src/cmd/compile/internal/x86/ssa.go | 2 |
5 files changed, 12 insertions, 12 deletions
diff --git a/src/cmd/compile/internal/gc/obj.go b/src/cmd/compile/internal/gc/obj.go index c17f578898..1971fb7d16 100644 --- a/src/cmd/compile/internal/gc/obj.go +++ b/src/cmd/compile/internal/gc/obj.go @@ -242,7 +242,7 @@ func Linksym(s *Sym) *obj.LSym { name = s.Pkg.Prefix + "." + s.Name } - ls := obj.Linklookup(Ctxt, name, 0) + ls := Ctxt.Lookup(name, 0) s.Lsym = ls return ls } @@ -302,7 +302,7 @@ func stringsym(s string) (data *obj.LSym) { const prefix = "go.string." symdataname := prefix + symname - symdata := obj.Linklookup(Ctxt, symdataname, 0) + symdata := Ctxt.Lookup(symdataname, 0) if !symdata.SeenGlobl() { // string data diff --git a/src/cmd/compile/internal/gc/pgen.go b/src/cmd/compile/internal/gc/pgen.go index 12bb7bc66b..2f62528766 100644 --- a/src/cmd/compile/internal/gc/pgen.go +++ b/src/cmd/compile/internal/gc/pgen.go @@ -352,7 +352,7 @@ func debuginfo(fnsym *obj.LSym, curfn interface{}) []*dwarf.Var { gotype := Linksym(ngotype(n)) fnsym.Autom = append(fnsym.Autom, &obj.Auto{ - Asym: obj.Linklookup(Ctxt, n.Sym.Name, 0), + Asym: Ctxt.Lookup(n.Sym.Name, 0), Aoffset: int32(n.Xoffset), Name: name, Gotype: gotype, @@ -367,7 +367,7 @@ func debuginfo(fnsym *obj.LSym, curfn interface{}) []*dwarf.Var { Name: n.Sym.Name, Abbrev: abbrev, Offset: int32(offs), - Type: obj.Linklookup(Ctxt, typename, 0), + Type: Ctxt.Lookup(typename, 0), }) } diff --git a/src/cmd/compile/internal/gc/reflect.go b/src/cmd/compile/internal/gc/reflect.go index 1ad70fcd46..b11ca7082a 100644 --- a/src/cmd/compile/internal/gc/reflect.go +++ b/src/cmd/compile/internal/gc/reflect.go @@ -454,7 +454,7 @@ func dimportpath(p *Pkg) { str = p.Path } - s := obj.Linklookup(Ctxt, "type..importpath."+p.Prefix+".", 0) + s := Ctxt.Lookup("type..importpath."+p.Prefix+".", 0) ot := dnameData(s, 0, str, "", nil, false) ggloblLSym(s, int32(ot), obj.DUPOK|obj.RODATA) p.Pathsym = s @@ -475,7 +475,7 @@ func dgopkgpathLSym(s *obj.LSym, ot int, pkg *Pkg) int { // type..importpath.""., which the linker will rewrite using the correct import path. // Every package that imports this one directly defines the symbol. // See also https://groups.google.com/forum/#!topic/golang-dev/myb9s53HxGQ. - ns := obj.Linklookup(Ctxt, `type..importpath."".`, 0) + ns := Ctxt.Lookup(`type..importpath."".`, 0) return dsymptrLSym(s, ot, ns, 0) } @@ -494,7 +494,7 @@ func dgopkgpathOffLSym(s *obj.LSym, ot int, pkg *Pkg) int { // type..importpath.""., which the linker will rewrite using the correct import path. // Every package that imports this one directly defines the symbol. // See also https://groups.google.com/forum/#!topic/golang-dev/myb9s53HxGQ. - ns := obj.Linklookup(Ctxt, `type..importpath."".`, 0) + ns := Ctxt.Lookup(`type..importpath."".`, 0) return dsymptrOffLSym(s, ot, ns, 0) } @@ -598,7 +598,7 @@ func dname(name, tag string, pkg *Pkg, exported bool) *obj.LSym { sname = fmt.Sprintf(`%s"".%d`, sname, dnameCount) dnameCount++ } - s := obj.Linklookup(Ctxt, sname, 0) + s := Ctxt.Lookup(sname, 0) if len(s.P) > 0 { return s } @@ -1466,7 +1466,7 @@ func dumptypestructs() { // process ptabs if localpkg.Name == "main" && len(ptabs) > 0 { ot := 0 - s := obj.Linklookup(Ctxt, "go.plugin.tabs", 0) + s := Ctxt.Lookup("go.plugin.tabs", 0) for _, p := range ptabs { // Dump ptab symbol into go.pluginsym package. // @@ -1481,7 +1481,7 @@ func dumptypestructs() { ggloblLSym(s, int32(ot), int16(obj.RODATA)) ot = 0 - s = obj.Linklookup(Ctxt, "go.plugin.exports", 0) + s = Ctxt.Lookup("go.plugin.exports", 0) for _, p := range ptabs { ot = dsymptrLSym(s, ot, Linksym(p.s), 0) } diff --git a/src/cmd/compile/internal/ssa/export_test.go b/src/cmd/compile/internal/ssa/export_test.go index f7a80a8c00..1b18d74575 100644 --- a/src/cmd/compile/internal/ssa/export_test.go +++ b/src/cmd/compile/internal/ssa/export_test.go @@ -114,7 +114,7 @@ func (DummyFrontend) Line(_ src.XPos) string { func (DummyFrontend) AllocFrame(f *Func) { } func (d DummyFrontend) Syslook(s string) *obj.LSym { - return obj.Linklookup(d.ctxt, s, 0) + return d.ctxt.Lookup(s, 0) } func (DummyFrontend) UseWriteBarrier() bool { return true // only writebarrier_test cares diff --git a/src/cmd/compile/internal/x86/ssa.go b/src/cmd/compile/internal/x86/ssa.go index d11cf5cad7..144cfaee2d 100644 --- a/src/cmd/compile/internal/x86/ssa.go +++ b/src/cmd/compile/internal/x86/ssa.go @@ -452,7 +452,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) { p := s.Prog(x86.ALEAL) p.From.Type = obj.TYPE_MEM p.From.Name = obj.NAME_EXTERN - p.From.Sym = obj.Linklookup(gc.Ctxt, literal, 0) + p.From.Sym = gc.Ctxt.Lookup(literal, 0) p.From.Sym.Set(obj.AttrLocal, true) p.To.Type = obj.TYPE_REG p.To.Reg = v.Reg() |