Commit a495fe27 authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

cmd/compile: make ggloblsym work with obj.LSyms

Automated refactoring using gorename, eg, and gofmt -r.

Passes toolstash-check.

Change-Id: Ib50f368bf62a07e5ced50b1b92a29c669ba9a158
Reviewed-on: https://go-review.googlesource.com/41401
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
parent b01be13e
...@@ -225,11 +225,7 @@ func ggloblnod(nam *Node) { ...@@ -225,11 +225,7 @@ func ggloblnod(nam *Node) {
Ctxt.Globl(s, nam.Type.Width, flags) Ctxt.Globl(s, nam.Type.Width, flags)
} }
func ggloblsym(s *types.Sym, width int32, flags int16) { func ggloblsym(s *obj.LSym, width int32, flags int16) {
ggloblLSym(s.Linksym(), width, flags)
}
func ggloblLSym(s *obj.LSym, width int32, flags int16) {
if flags&obj.LOCAL != 0 { if flags&obj.LOCAL != 0 {
s.Set(obj.AttrLocal, true) s.Set(obj.AttrLocal, true)
flags &^= obj.LOCAL flags &^= obj.LOCAL
......
...@@ -150,7 +150,7 @@ func dumpobj1(outfile string, mode int) { ...@@ -150,7 +150,7 @@ func dumpobj1(outfile string, mode int) {
if zerosize > 0 { if zerosize > 0 {
zero := mappkg.Lookup("zero") zero := mappkg.Lookup("zero")
ggloblsym(zero, int32(zerosize), obj.DUPOK|obj.RODATA) ggloblsym(zero.Linksym(), int32(zerosize), obj.DUPOK|obj.RODATA)
} }
addGCLocals() addGCLocals()
...@@ -223,7 +223,7 @@ func dumpglobls() { ...@@ -223,7 +223,7 @@ func dumpglobls() {
for _, s := range funcsyms { for _, s := range funcsyms {
sf := s.Pkg.Lookup(funcsymname(s)) sf := s.Pkg.Lookup(funcsymname(s))
dsymptr(sf.Linksym(), 0, s.Linksym(), 0) dsymptr(sf.Linksym(), 0, s.Linksym(), 0)
ggloblsym(sf, int32(Widthptr), obj.DUPOK|obj.RODATA) ggloblsym(sf.Linksym(), int32(Widthptr), obj.DUPOK|obj.RODATA)
} }
// Do not reprocess funcsyms on next dumpglobls call. // Do not reprocess funcsyms on next dumpglobls call.
...@@ -310,7 +310,7 @@ func stringsym(s string) (data *obj.LSym) { ...@@ -310,7 +310,7 @@ func stringsym(s string) (data *obj.LSym) {
if !symdata.SeenGlobl() { if !symdata.SeenGlobl() {
// string data // string data
off := dsname(symdata, 0, s) off := dsname(symdata, 0, s)
ggloblLSym(symdata, int32(off), obj.DUPOK|obj.RODATA|obj.LOCAL) ggloblsym(symdata, int32(off), obj.DUPOK|obj.RODATA|obj.LOCAL)
} }
return symdata return symdata
...@@ -325,7 +325,7 @@ func slicebytes(nam *Node, s string, len int) { ...@@ -325,7 +325,7 @@ func slicebytes(nam *Node, s string, len int) {
sym.Def = asTypesNode(newname(sym)) sym.Def = asTypesNode(newname(sym))
off := dsname(sym.Linksym(), 0, s) off := dsname(sym.Linksym(), 0, s)
ggloblsym(sym, int32(off), obj.NOPTR|obj.LOCAL) ggloblsym(sym.Linksym(), int32(off), obj.NOPTR|obj.LOCAL)
if nam.Op != ONAME { if nam.Op != ONAME {
Fatalf("slicebytes %v", nam) Fatalf("slicebytes %v", nam)
......
...@@ -51,7 +51,7 @@ func emitptrargsmap() { ...@@ -51,7 +51,7 @@ func emitptrargsmap() {
off = dbvec(lsym, off, bv) off = dbvec(lsym, off, bv)
} }
ggloblLSym(lsym, int32(off), obj.RODATA|obj.LOCAL) ggloblsym(lsym, int32(off), obj.RODATA|obj.LOCAL)
} }
// cmpstackvarlt reports whether the stack variable a sorts before b. // cmpstackvarlt reports whether the stack variable a sorts before b.
......
...@@ -449,7 +449,7 @@ func dimportpath(p *types.Pkg) { ...@@ -449,7 +449,7 @@ func dimportpath(p *types.Pkg) {
s := Ctxt.Lookup("type..importpath." + p.Prefix + ".") s := Ctxt.Lookup("type..importpath." + p.Prefix + ".")
ot := dnameData(s, 0, str, "", nil, false) ot := dnameData(s, 0, str, "", nil, false)
ggloblLSym(s, int32(ot), obj.DUPOK|obj.RODATA) ggloblsym(s, int32(ot), obj.DUPOK|obj.RODATA)
p.Pathsym = s p.Pathsym = s
} }
...@@ -592,7 +592,7 @@ func dname(name, tag string, pkg *types.Pkg, exported bool) *obj.LSym { ...@@ -592,7 +592,7 @@ func dname(name, tag string, pkg *types.Pkg, exported bool) *obj.LSym {
return s return s
} }
ot := dnameData(s, 0, name, tag, pkg, exported) ot := dnameData(s, 0, name, tag, pkg, exported)
ggloblLSym(s, int32(ot), obj.DUPOK|obj.RODATA) ggloblsym(s, int32(ot), obj.DUPOK|obj.RODATA)
return s return s
} }
...@@ -1319,7 +1319,7 @@ ok: ...@@ -1319,7 +1319,7 @@ ok:
} }
ot = dextratypeData(s, ot, t) ot = dextratypeData(s, ot, t)
ggloblsym(s, int32(ot), int16(dupok|obj.RODATA)) ggloblsym(s.Linksym(), int32(ot), int16(dupok|obj.RODATA))
// The linker will leave a table of all the typelinks for // The linker will leave a table of all the typelinks for
// types in the binary, so the runtime can find them. // types in the binary, so the runtime can find them.
...@@ -1469,11 +1469,11 @@ func dumptypestructs() { ...@@ -1469,11 +1469,11 @@ func dumptypestructs() {
o += len(imethods(i.itype)) * Widthptr // skip fun method pointers o += len(imethods(i.itype)) * Widthptr // skip fun method pointers
// at runtime the itab will contain pointers to types, other itabs and // at runtime the itab will contain pointers to types, other itabs and
// method functions. None are allocated on heap, so we can use obj.NOPTR. // method functions. None are allocated on heap, so we can use obj.NOPTR.
ggloblsym(i.sym, int32(o), int16(obj.DUPOK|obj.NOPTR)) ggloblsym(i.sym.Linksym(), int32(o), int16(obj.DUPOK|obj.NOPTR))
ilink := itablinkpkg.Lookup(i.t.ShortString() + "," + i.itype.ShortString()) ilink := itablinkpkg.Lookup(i.t.ShortString() + "," + i.itype.ShortString())
dsymptr(ilink.Linksym(), 0, i.sym.Linksym(), 0) dsymptr(ilink.Linksym(), 0, i.sym.Linksym(), 0)
ggloblsym(ilink, int32(Widthptr), int16(obj.DUPOK|obj.RODATA)) ggloblsym(ilink.Linksym(), int32(Widthptr), int16(obj.DUPOK|obj.RODATA))
} }
// process ptabs // process ptabs
...@@ -1491,14 +1491,14 @@ func dumptypestructs() { ...@@ -1491,14 +1491,14 @@ func dumptypestructs() {
ot = dsymptrOff(s, ot, nsym, 0) ot = dsymptrOff(s, ot, nsym, 0)
ot = dsymptrOff(s, ot, dtypesym(p.t).Linksym(), 0) ot = dsymptrOff(s, ot, dtypesym(p.t).Linksym(), 0)
} }
ggloblLSym(s, int32(ot), int16(obj.RODATA)) ggloblsym(s, int32(ot), int16(obj.RODATA))
ot = 0 ot = 0
s = Ctxt.Lookup("go.plugin.exports") s = Ctxt.Lookup("go.plugin.exports")
for _, p := range ptabs { for _, p := range ptabs {
ot = dsymptr(s, ot, p.s.Linksym(), 0) ot = dsymptr(s, ot, p.s.Linksym(), 0)
} }
ggloblLSym(s, int32(ot), int16(obj.RODATA)) ggloblsym(s, int32(ot), int16(obj.RODATA))
} }
// generate import strings for imported packages // generate import strings for imported packages
...@@ -1581,7 +1581,7 @@ func dalgsym(t *types.Type) *types.Sym { ...@@ -1581,7 +1581,7 @@ func dalgsym(t *types.Type) *types.Sym {
ot := 0 ot := 0
ot = dsymptr(hashfunc.Linksym(), ot, memhashvarlen, 0) ot = dsymptr(hashfunc.Linksym(), ot, memhashvarlen, 0)
ot = duintptr(hashfunc.Linksym(), ot, uint64(t.Width)) // size encoded in closure ot = duintptr(hashfunc.Linksym(), ot, uint64(t.Width)) // size encoded in closure
ggloblsym(hashfunc, int32(ot), obj.DUPOK|obj.RODATA) ggloblsym(hashfunc.Linksym(), int32(ot), obj.DUPOK|obj.RODATA)
// make equality closure // make equality closure
p = fmt.Sprintf(".eqfunc%d", t.Width) p = fmt.Sprintf(".eqfunc%d", t.Width)
...@@ -1591,7 +1591,7 @@ func dalgsym(t *types.Type) *types.Sym { ...@@ -1591,7 +1591,7 @@ func dalgsym(t *types.Type) *types.Sym {
ot = 0 ot = 0
ot = dsymptr(eqfunc.Linksym(), ot, memequalvarlen, 0) ot = dsymptr(eqfunc.Linksym(), ot, memequalvarlen, 0)
ot = duintptr(eqfunc.Linksym(), ot, uint64(t.Width)) ot = duintptr(eqfunc.Linksym(), ot, uint64(t.Width))
ggloblsym(eqfunc, int32(ot), obj.DUPOK|obj.RODATA) ggloblsym(eqfunc.Linksym(), int32(ot), obj.DUPOK|obj.RODATA)
} else { } else {
// generate an alg table specific to this type // generate an alg table specific to this type
s = typesymprefix(".alg", t) s = typesymprefix(".alg", t)
...@@ -1607,9 +1607,9 @@ func dalgsym(t *types.Type) *types.Sym { ...@@ -1607,9 +1607,9 @@ func dalgsym(t *types.Type) *types.Sym {
// make Go funcs (closures) for calling hash and equal from Go // make Go funcs (closures) for calling hash and equal from Go
dsymptr(hashfunc.Linksym(), 0, hash.Linksym(), 0) dsymptr(hashfunc.Linksym(), 0, hash.Linksym(), 0)
ggloblsym(hashfunc, int32(Widthptr), obj.DUPOK|obj.RODATA) ggloblsym(hashfunc.Linksym(), int32(Widthptr), obj.DUPOK|obj.RODATA)
dsymptr(eqfunc.Linksym(), 0, eq.Linksym(), 0) dsymptr(eqfunc.Linksym(), 0, eq.Linksym(), 0)
ggloblsym(eqfunc, int32(Widthptr), obj.DUPOK|obj.RODATA) ggloblsym(eqfunc.Linksym(), int32(Widthptr), obj.DUPOK|obj.RODATA)
} }
// ../../../../runtime/alg.go:/typeAlg // ../../../../runtime/alg.go:/typeAlg
...@@ -1617,7 +1617,7 @@ func dalgsym(t *types.Type) *types.Sym { ...@@ -1617,7 +1617,7 @@ func dalgsym(t *types.Type) *types.Sym {
ot = dsymptr(s.Linksym(), ot, hashfunc.Linksym(), 0) ot = dsymptr(s.Linksym(), ot, hashfunc.Linksym(), 0)
ot = dsymptr(s.Linksym(), ot, eqfunc.Linksym(), 0) ot = dsymptr(s.Linksym(), ot, eqfunc.Linksym(), 0)
ggloblsym(s, int32(ot), obj.DUPOK|obj.RODATA) ggloblsym(s.Linksym(), int32(ot), obj.DUPOK|obj.RODATA)
return s return s
} }
...@@ -1682,7 +1682,7 @@ func dgcptrmask(t *types.Type) *types.Sym { ...@@ -1682,7 +1682,7 @@ func dgcptrmask(t *types.Type) *types.Sym {
for i, x := range ptrmask { for i, x := range ptrmask {
duint8(sym.Linksym(), i, x) duint8(sym.Linksym(), i, x)
} }
ggloblsym(sym, int32(len(ptrmask)), obj.DUPOK|obj.RODATA|obj.LOCAL) ggloblsym(sym.Linksym(), int32(len(ptrmask)), obj.DUPOK|obj.RODATA|obj.LOCAL)
} }
return sym return sym
} }
...@@ -1756,7 +1756,7 @@ func (p *GCProg) writeByte(x byte) { ...@@ -1756,7 +1756,7 @@ func (p *GCProg) writeByte(x byte) {
func (p *GCProg) end() { func (p *GCProg) end() {
p.w.End() p.w.End()
duint32(p.sym.Linksym(), 0, uint32(p.symoff-4)) duint32(p.sym.Linksym(), 0, uint32(p.symoff-4))
ggloblsym(p.sym, int32(p.symoff), obj.DUPOK|obj.RODATA|obj.LOCAL) ggloblsym(p.sym.Linksym(), int32(p.symoff), obj.DUPOK|obj.RODATA|obj.LOCAL)
if Debug_gcprog > 0 { if Debug_gcprog > 0 {
fmt.Fprintf(os.Stderr, "compile: end GCProg for %v\n", p.sym) fmt.Fprintf(os.Stderr, "compile: end GCProg for %v\n", p.sym)
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment