diff --git a/src/cmd/compile/internal/dwarfgen/dwarf.go b/src/cmd/compile/internal/dwarfgen/dwarf.go index 19cb70058c9..d0bee58442e 100644 --- a/src/cmd/compile/internal/dwarfgen/dwarf.go +++ b/src/cmd/compile/internal/dwarfgen/dwarf.go @@ -26,7 +26,7 @@ func Info(fnsym *obj.LSym, infosym *obj.LSym, curfn interface{}) ([]dwarf.Scope, fn := curfn.(*ir.Func) if fn.Nname != nil { - expect := fn.Sym().Linksym() + expect := fn.Linksym() if fnsym.ABI() == obj.ABI0 { expect = fn.Sym().LinksymABI0() } @@ -90,7 +90,7 @@ func Info(fnsym *obj.LSym, infosym *obj.LSym, curfn interface{}) ([]dwarf.Scope, continue } apdecls = append(apdecls, n) - fnsym.Func().RecordAutoType(reflectdata.TypeSym(n.Type()).Linksym()) + fnsym.Func().RecordAutoType(reflectdata.TypeLinksym(n.Type())) } } @@ -240,7 +240,7 @@ func createDwarfVars(fnsym *obj.LSym, complexOK bool, fn *ir.Func, apDecls []*ir ChildIndex: -1, }) // Record go type of to insure that it gets emitted by the linker. - fnsym.Func().RecordAutoType(reflectdata.TypeSym(n.Type()).Linksym()) + fnsym.Func().RecordAutoType(reflectdata.TypeLinksym(n.Type())) } return decls, vars @@ -309,7 +309,7 @@ func createSimpleVar(fnsym *obj.LSym, n *ir.Name) *dwarf.Var { } typename := dwarf.InfoPrefix + types.TypeSymName(n.Type()) - delete(fnsym.Func().Autot, reflectdata.TypeSym(n.Type()).Linksym()) + delete(fnsym.Func().Autot, reflectdata.TypeLinksym(n.Type())) inlIndex := 0 if base.Flag.GenDwarfInl > 1 { if n.Name().InlFormal() || n.Name().InlLocal() { @@ -376,7 +376,7 @@ func createComplexVar(fnsym *obj.LSym, fn *ir.Func, varID ssa.VarID) *dwarf.Var return nil } - gotype := reflectdata.TypeSym(n.Type()).Linksym() + gotype := reflectdata.TypeLinksym(n.Type()) delete(fnsym.Func().Autot, gotype) typename := dwarf.InfoPrefix + gotype.Name[len("type."):] inlIndex := 0 diff --git a/src/cmd/compile/internal/gc/abiutils_test.go b/src/cmd/compile/internal/gc/abiutils_test.go index a421a229dc7..656eab18cbe 100644 --- a/src/cmd/compile/internal/gc/abiutils_test.go +++ b/src/cmd/compile/internal/gc/abiutils_test.go @@ -40,10 +40,10 @@ func TestMain(m *testing.M) { types.PtrSize = ssagen.Arch.LinkArch.PtrSize types.RegSize = ssagen.Arch.LinkArch.RegSize types.TypeLinkSym = func(t *types.Type) *obj.LSym { - return reflectdata.TypeSym(t).Linksym() + return reflectdata.TypeLinksym(t) } types.TypeLinkSym = func(t *types.Type) *obj.LSym { - return reflectdata.TypeSym(t).Linksym() + return reflectdata.TypeLinksym(t) } typecheck.Init() os.Exit(m.Run()) diff --git a/src/cmd/compile/internal/gc/compile.go b/src/cmd/compile/internal/gc/compile.go index 926b2dee952..1b3dd672f3f 100644 --- a/src/cmd/compile/internal/gc/compile.go +++ b/src/cmd/compile/internal/gc/compile.go @@ -174,5 +174,5 @@ func isInlinableButNotInlined(fn *ir.Func) bool { if fn.Sym() == nil { return true } - return !fn.Sym().Linksym().WasInlined() + return !fn.Linksym().WasInlined() } diff --git a/src/cmd/compile/internal/gc/main.go b/src/cmd/compile/internal/gc/main.go index ced82736ce4..a4613f04fbc 100644 --- a/src/cmd/compile/internal/gc/main.go +++ b/src/cmd/compile/internal/gc/main.go @@ -191,7 +191,7 @@ func Main(archInit func(*ssagen.ArchInfo)) { types.RegSize = ssagen.Arch.LinkArch.RegSize types.MaxWidth = ssagen.Arch.MAXWIDTH types.TypeLinkSym = func(t *types.Type) *obj.LSym { - return reflectdata.TypeSym(t).Linksym() + return reflectdata.TypeLinksym(t) } typecheck.Target = new(ir.Package) @@ -203,7 +203,7 @@ func Main(archInit func(*ssagen.ArchInfo)) { base.AutogeneratedPos = makePos(src.NewFileBase("", ""), 1, 0) types.TypeLinkSym = func(t *types.Type) *obj.LSym { - return reflectdata.TypeSym(t).Linksym() + return reflectdata.TypeLinksym(t) } typecheck.Init() diff --git a/src/cmd/compile/internal/gc/obj.go b/src/cmd/compile/internal/gc/obj.go index d0454981f44..45eadf719e3 100644 --- a/src/cmd/compile/internal/gc/obj.go +++ b/src/cmd/compile/internal/gc/obj.go @@ -261,8 +261,8 @@ func addGCLocals() { } func ggloblnod(nam *ir.Name) { - s := nam.Sym().Linksym() - s.Gotype = reflectdata.TypeSym(nam.Type()).Linksym() + s := nam.Linksym() + s.Gotype = reflectdata.TypeLinksym(nam.Type()) flags := 0 if nam.Name().Readonly() { flags = obj.RODATA diff --git a/src/cmd/compile/internal/inline/inl.go b/src/cmd/compile/internal/inline/inl.go index fc6a17b9337..126871b8055 100644 --- a/src/cmd/compile/internal/inline/inl.go +++ b/src/cmd/compile/internal/inline/inl.go @@ -932,7 +932,7 @@ func mkinlcall(n *ir.CallExpr, fn *ir.Func, maxCost int32, inlMap map[*ir.Func]b parent = b.InliningIndex() } - sym := fn.Sym().Linksym() + sym := fn.Linksym() newIndex := base.Ctxt.InlTree.Add(parent, n.Pos(), sym) // Add an inline mark just before the inlined body. diff --git a/src/cmd/compile/internal/ir/name.go b/src/cmd/compile/internal/ir/name.go index b13b57e95fa..79583914353 100644 --- a/src/cmd/compile/internal/ir/name.go +++ b/src/cmd/compile/internal/ir/name.go @@ -314,7 +314,7 @@ func (n *Name) MarkReadonly() { // Mark the linksym as readonly immediately // so that the SSA backend can use this information. // It will be overridden later during dumpglobls. - n.Sym().Linksym().Type = objabi.SRODATA + n.Linksym().Type = objabi.SRODATA } // Val returns the constant.Value for the node. diff --git a/src/cmd/compile/internal/pkginit/init.go b/src/cmd/compile/internal/pkginit/init.go index f964edee883..8e3592700c3 100644 --- a/src/cmd/compile/internal/pkginit/init.go +++ b/src/cmd/compile/internal/pkginit/init.go @@ -34,7 +34,7 @@ func Task() *ir.Name { if n.Op() != ir.ONAME || n.(*ir.Name).Class_ != ir.PEXTERN { base.Fatalf("bad inittask: %v", n) } - deps = append(deps, n.(*ir.Name).Sym().Linksym()) + deps = append(deps, n.(*ir.Name).Linksym()) } // Make a function that contains all the initialization statements. @@ -74,7 +74,7 @@ func Task() *ir.Name { continue } } - fns = append(fns, fn.Nname.Sym().Linksym()) + fns = append(fns, fn.Nname.Linksym()) } if len(deps) == 0 && len(fns) == 0 && types.LocalPkg.Name != "main" && types.LocalPkg.Name != "runtime" { diff --git a/src/cmd/compile/internal/reflectdata/alg.go b/src/cmd/compile/internal/reflectdata/alg.go index 1f943f5795b..5603aefa77e 100644 --- a/src/cmd/compile/internal/reflectdata/alg.go +++ b/src/cmd/compile/internal/reflectdata/alg.go @@ -104,7 +104,7 @@ func genhash(t *types.Type) *obj.LSym { // For other sizes of plain memory, we build a closure // that calls memhash_varlen. The size of the memory is // encoded in the first slot of the closure. - closure := types.TypeSymLookup(fmt.Sprintf(".hashfunc%d", t.Width)).Linksym() + closure := TypeLinksymLookup(fmt.Sprintf(".hashfunc%d", t.Width)) if len(closure.P) > 0 { // already generated return closure } @@ -120,7 +120,7 @@ func genhash(t *types.Type) *obj.LSym { break } - closure := TypeSymPrefix(".hashfunc", t).Linksym() + closure := TypeLinksymPrefix(".hashfunc", t) if len(closure.P) > 0 { // already generated return closure } @@ -347,7 +347,7 @@ func geneq(t *types.Type) *obj.LSym { case types.AMEM: // make equality closure. The size of the type // is encoded in the closure. - closure := types.TypeSymLookup(fmt.Sprintf(".eqfunc%d", t.Width)).Linksym() + closure := TypeLinksymLookup(fmt.Sprintf(".eqfunc%d", t.Width)) if len(closure.P) != 0 { return closure } @@ -363,7 +363,7 @@ func geneq(t *types.Type) *obj.LSym { break } - closure := TypeSymPrefix(".eqfunc", t).Linksym() + closure := TypeLinksymPrefix(".eqfunc", t) if len(closure.P) > 0 { // already generated return closure } diff --git a/src/cmd/compile/internal/reflectdata/reflect.go b/src/cmd/compile/internal/reflectdata/reflect.go index 4c625b40cb8..87f381fbdd5 100644 --- a/src/cmd/compile/internal/reflectdata/reflect.go +++ b/src/cmd/compile/internal/reflectdata/reflect.go @@ -1583,7 +1583,7 @@ func dgcprog(t *types.Type) (*obj.LSym, int64) { if t.Width == types.BADWIDTH { base.Fatalf("dgcprog: %v badwidth", t) } - lsym := TypeSymPrefix(".gcprog", t).Linksym() + lsym := TypeLinksymPrefix(".gcprog", t) var p gcProg p.init(lsym) p.emit(t, 0) @@ -1857,7 +1857,7 @@ var ZeroSize int64 // MarkTypeUsedInInterface marks that type t is converted to an interface. // This information is used in the linker in dead method elimination. func MarkTypeUsedInInterface(t *types.Type, from *obj.LSym) { - tsym := TypeSym(t).Linksym() + tsym := TypeLinksym(t) // Emit a marker relocation. The linker will know the type is converted // to an interface if "from" is reachable. r := obj.Addrel(from) @@ -1870,7 +1870,7 @@ func MarkTypeUsedInInterface(t *types.Type, from *obj.LSym) { func MarkUsedIfaceMethod(n *ir.CallExpr) { dot := n.X.(*ir.SelectorExpr) ityp := dot.X.Type() - tsym := TypeSym(ityp).Linksym() + tsym := TypeLinksym(ityp) r := obj.Addrel(ir.CurFunc.LSym) r.Sym = tsym // dot.Xoffset is the method index * Widthptr (the offset of code pointer diff --git a/src/cmd/compile/internal/ssagen/abi.go b/src/cmd/compile/internal/ssagen/abi.go index b0338e8155d..cd5d962b918 100644 --- a/src/cmd/compile/internal/ssagen/abi.go +++ b/src/cmd/compile/internal/ssagen/abi.go @@ -166,7 +166,7 @@ func selectLSym(f *ir.Func, hasBody bool) { f.LSym = nam.Sym().LinksymABI0() needABIWrapper, wrapperABI = true, obj.ABIInternal } else { - f.LSym = nam.Sym().Linksym() + f.LSym = nam.Linksym() // No ABI override. Check that the symbol is // using the expected ABI. want := obj.ABIInternal diff --git a/src/cmd/compile/internal/ssagen/ssa.go b/src/cmd/compile/internal/ssagen/ssa.go index 5cf267636bd..15c023d3325 100644 --- a/src/cmd/compile/internal/ssagen/ssa.go +++ b/src/cmd/compile/internal/ssagen/ssa.go @@ -2112,7 +2112,7 @@ func (s *state) expr(n ir.Node) *ssa.Value { n := n.(*ir.Name) if n.Class_ == ir.PFUNC { // "value" of a function is the address of the function's closure - sym := staticdata.FuncSym(n.Sym()).Linksym() + sym := staticdata.FuncLinksym(n) return s.entryNewValue1A(ssa.OpAddr, types.NewPtr(n.Type()), sym, s.sb) } if s.canSSA(n) { @@ -4959,7 +4959,7 @@ func (s *state) addr(n ir.Node) *ssa.Value { switch n.Class_ { case ir.PEXTERN: // global variable - v := s.entryNewValue1A(ssa.OpAddr, t, n.Sym().Linksym(), s.sb) + v := s.entryNewValue1A(ssa.OpAddr, t, n.Linksym(), s.sb) // TODO: Make OpAddr use AuxInt as well as Aux. if offset != 0 { v = s.entryNewValue1I(ssa.OpOffPtr, v.Type, offset, v) @@ -6831,7 +6831,7 @@ func AddAux2(a *obj.Addr, v *ssa.Value, offset int64) { break } a.Name = obj.NAME_AUTO - a.Sym = n.Sym().Linksym() + a.Sym = n.Linksym() a.Offset += n.FrameOffset() default: v.Fatalf("aux in %s not implemented %#v", v, v.Aux) @@ -6963,7 +6963,7 @@ func CheckLoweredGetClosurePtr(v *ssa.Value) { func AddrAuto(a *obj.Addr, v *ssa.Value) { n, off := ssa.AutoVar(v) a.Type = obj.TYPE_MEM - a.Sym = n.Sym().Linksym() + a.Sym = n.Linksym() a.Reg = int16(Arch.REGSP) a.Offset = n.FrameOffset() + off if n.Class_ == ir.PPARAM || n.Class_ == ir.PPARAMOUT { @@ -6979,7 +6979,7 @@ func (s *State) AddrScratch(a *obj.Addr) { } a.Type = obj.TYPE_MEM a.Name = obj.NAME_AUTO - a.Sym = s.ScratchFpMem.Sym().Linksym() + a.Sym = s.ScratchFpMem.Linksym() a.Reg = int16(Arch.REGSP) a.Offset = s.ScratchFpMem.Offset_ } diff --git a/src/cmd/compile/internal/staticdata/data.go b/src/cmd/compile/internal/staticdata/data.go index ab9cb5bd7ec..260731244fc 100644 --- a/src/cmd/compile/internal/staticdata/data.go +++ b/src/cmd/compile/internal/staticdata/data.go @@ -37,8 +37,8 @@ func InitAddr(n *ir.Name, noff int64, a *ir.Name, aoff int64) { if a.Op() != ir.ONAME { base.Fatalf("addrsym a op %v", a.Op()) } - s := n.Sym().Linksym() - s.WriteAddr(base.Ctxt, noff, types.PtrSize, a.Sym().Linksym(), aoff) + s := n.Linksym() + s.WriteAddr(base.Ctxt, noff, types.PtrSize, a.Linksym(), aoff) } // InitFunc writes the static address of f to n. f must be a global function. @@ -53,18 +53,18 @@ func InitFunc(n *ir.Name, noff int64, f *ir.Name) { if f.Class_ != ir.PFUNC { base.Fatalf("pfuncsym class not PFUNC %d", f.Class_) } - s := n.Sym().Linksym() - s.WriteAddr(base.Ctxt, noff, types.PtrSize, FuncSym(f.Sym()).Linksym(), 0) + s := n.Linksym() + s.WriteAddr(base.Ctxt, noff, types.PtrSize, FuncLinksym(f), 0) } // InitSlice writes a static slice symbol {&arr, lencap, lencap} to n+noff. // InitSlice does not modify n. func InitSlice(n *ir.Name, noff int64, arr *ir.Name, lencap int64) { - s := n.Sym().Linksym() + s := n.Linksym() if arr.Op() != ir.ONAME { base.Fatalf("slicesym non-name arr %v", arr) } - s.WriteAddr(base.Ctxt, noff, types.PtrSize, arr.Sym().Linksym(), 0) + s.WriteAddr(base.Ctxt, noff, types.PtrSize, arr.Linksym(), 0) s.WriteInt(base.Ctxt, noff+types.SliceLenOffset, types.PtrSize, lencap) s.WriteInt(base.Ctxt, noff+types.SliceCapOffset, types.PtrSize, lencap) } @@ -141,7 +141,7 @@ func fileStringSym(pos src.XPos, file string, readonly bool, hash []byte) (*obj. if readonly { sym = StringSym(pos, string(data)) } else { - sym = slicedata(pos, string(data)).Sym().Linksym() + sym = slicedata(pos, string(data)).Linksym() } if len(hash) > 0 { sum := sha256.Sum256(data) @@ -189,7 +189,7 @@ func fileStringSym(pos src.XPos, file string, readonly bool, hash []byte) (*obj. } else { // Emit a zero-length data symbol // and then fix up length and content to use file. - symdata = slicedata(pos, "").Sym().Linksym() + symdata = slicedata(pos, "").Linksym() symdata.Size = size symdata.Type = objabi.SNOPTRDATA info := symdata.NewFileInfo() @@ -318,7 +318,7 @@ func InitConst(n *ir.Name, noff int64, c ir.Node, wid int) { if c.Op() != ir.OLITERAL { base.Fatalf("litsym c op %v", c.Op()) } - s := n.Sym().Linksym() + s := n.Linksym() switch u := c.Val(); u.Kind() { case constant.Bool: i := int64(obj.Bool2int(constant.BoolVal(u))) diff --git a/src/cmd/compile/internal/staticdata/embed.go b/src/cmd/compile/internal/staticdata/embed.go index 55c9a3356e8..2e551f0b2c6 100644 --- a/src/cmd/compile/internal/staticdata/embed.go +++ b/src/cmd/compile/internal/staticdata/embed.go @@ -145,7 +145,7 @@ func WriteEmbed(v *ir.Name) { if err != nil { base.ErrorfAt(v.Pos(), "embed %s: %v", file, err) } - sym := v.Sym().Linksym() + sym := v.Linksym() off := 0 off = objw.SymPtr(sym, off, fsym, 0) // data string off = objw.Uintptr(sym, off, uint64(size)) // len @@ -187,7 +187,7 @@ func WriteEmbed(v *ir.Name) { } } objw.Global(slicedata, int32(off), obj.RODATA|obj.LOCAL) - sym := v.Sym().Linksym() + sym := v.Linksym() objw.SymPtr(sym, 0, slicedata, 0) } } diff --git a/src/cmd/compile/internal/staticinit/sched.go b/src/cmd/compile/internal/staticinit/sched.go index d8f51766dee..1b0af1b05d4 100644 --- a/src/cmd/compile/internal/staticinit/sched.go +++ b/src/cmd/compile/internal/staticinit/sched.go @@ -313,7 +313,7 @@ func (s *Schedule) StaticAssign(l *ir.Name, loff int64, r ir.Node, typ *types.Ty return val.Op() == ir.ONIL } - reflectdata.MarkTypeUsedInInterface(val.Type(), l.Sym().Linksym()) + reflectdata.MarkTypeUsedInInterface(val.Type(), l.Linksym()) var itab *ir.AddrExpr if typ.IsEmptyInterface() { @@ -445,7 +445,7 @@ func StaticName(t *types.Type) *ir.Name { statuniqgen++ typecheck.Declare(n, ir.PEXTERN) n.SetType(t) - n.Sym().Linksym().Set(obj.AttrLocal, true) + n.Linksym().Set(obj.AttrLocal, true) return n } diff --git a/src/cmd/compile/internal/walk/complit.go b/src/cmd/compile/internal/walk/complit.go index fadcd87f258..3c28ed70ade 100644 --- a/src/cmd/compile/internal/walk/complit.go +++ b/src/cmd/compile/internal/walk/complit.go @@ -59,7 +59,7 @@ func (c initContext) String() string { func readonlystaticname(t *types.Type) *ir.Name { n := staticinit.StaticName(t) n.MarkReadonly() - n.Sym().Linksym().Set(obj.AttrContentAddressable, true) + n.Linksym().Set(obj.AttrContentAddressable, true) return n } diff --git a/src/cmd/compile/internal/walk/race.go b/src/cmd/compile/internal/walk/race.go index 1fe439a99a4..87a8839dcd0 100644 --- a/src/cmd/compile/internal/walk/race.go +++ b/src/cmd/compile/internal/walk/race.go @@ -14,7 +14,7 @@ import ( ) func instrument(fn *ir.Func) { - if fn.Pragma&ir.Norace != 0 || (fn.Sym().Linksym() != nil && fn.Sym().Linksym().ABIWrapper()) { + if fn.Pragma&ir.Norace != 0 || (fn.Linksym() != nil && fn.Linksym().ABIWrapper()) { return }