types.SetSize(8)
ldr.SetAttrSpecial(types.Sym(), false)
- etypedesc := ldr.CreateSymForUpdate("runtime.etypedesc", 0)
- etypedesc.SetType(sym.STYPE)
- ldr.SetAttrSpecial(etypedesc.Sym(), false)
-
etypes := ldr.CreateSymForUpdate("runtime.etypes", 0)
etypes.SetType(sym.STYPE)
ldr.SetAttrSpecial(etypes.Sym(), false)
sect = createRelroSect(".go.type", sym.STYPE)
ldr.SetSymSect(ldr.LookupOrCreateSym("runtime.types", 0), sect)
- ldr.SetSymSect(ldr.LookupOrCreateSym("runtime.etypedesc", 0), sect)
ldr.SetSymSect(ldr.LookupOrCreateSym("runtime.etypes", 0), sect)
sect = createRelroSect(".go.func", sym.SGOFUNC)
})
// Find the end of the typelink descriptors.
- // The offset starts at 1 to match the increment in
+ // The size starts at 1 to match the increment in
// createRelroSect in allocateDataSections.
// TODO: This wastes some space.
- offset := int64(1)
+ typeLinkSize := int64(1)
for i := range sl {
si := sl[i].sym
+ if si == head {
+ continue
+ }
if _, isTypelink := typelinkStrings[si]; !isTypelink {
break
}
- offset = Rnd(offset, int64(symalign(ldr, si)))
- offset += sl[i].sz
+ typeLinkSize = Rnd(typeLinkSize, int64(symalign(ldr, si)))
+ typeLinkSize += sl[i].sz
}
- ldr.SetSymValue(ldr.LookupOrCreateSym("runtime.etypedesc", 0), offset)
+ // Store the length of the typelink descriptors
+ // in the typedesclen field of moduledata.
+ if ctxt.moduledataTypeDescOffset == 0 {
+ Errorf("internal error: phase error: moduledataTypeDescOffset not set in dodataSect")
+ } else {
+ su := ldr.MakeSymbolUpdater(ctxt.Moduledata)
+ su.SetUint(ctxt.Arch, ctxt.moduledataTypeDescOffset, uint64(typeLinkSize))
+ }
default:
sort.Slice(sl, sortFn)
ctxt.xdefine("runtime.rodata", sym.SRODATA, int64(rodata.Vaddr))
ctxt.xdefine("runtime.erodata", sym.SRODATA, int64(rodata.Vaddr+rodata.Length))
ctxt.xdefine("runtime.types", sym.SRODATA, int64(types.Vaddr))
- // etypedesc was set to the offset from the symbol start in dodataSect.
- s := ldr.Lookup("runtime.etypedesc", 0)
- ctxt.xdefine("runtime.etypedesc", sym.SRODATA, int64(types.Vaddr+uint64(ldr.SymValue(s))))
ctxt.xdefine("runtime.etypes", sym.SRODATA, int64(types.Vaddr+types.Length))
- s = ldr.Lookup("runtime.gcdata", 0)
+ s := ldr.Lookup("runtime.gcdata", 0)
ldr.SetAttrLocal(s, true)
ctxt.xdefine("runtime.egcdata", sym.SRODATA, ldr.SymAddr(s)+ldr.SymSize(s))
ldr.SetSymSect(ldr.LookupOrCreateSym("runtime.egcdata", 0), ldr.SymSect(s))
ctxt.xdefine("runtime.rodata", sym.SRODATA, 0)
ctxt.xdefine("runtime.erodata", sym.SRODATAEND, 0)
ctxt.xdefine("runtime.types", sym.SRODATA, 0)
- ctxt.xdefine("runtime.etypedesc", sym.SRODATA, 0)
ctxt.xdefine("runtime.etypes", sym.SRODATA, 0)
ctxt.xdefine("runtime.noptrdata", sym.SNOPTRDATA, 0)
ctxt.xdefine("runtime.enoptrdata", sym.SNOPTRDATAEND, 0)
moduledata.AddAddr(ctxt.Arch, ldr.Lookup("runtime.gcdata", 0))
moduledata.AddAddr(ctxt.Arch, ldr.Lookup("runtime.gcbss", 0))
moduledata.AddAddr(ctxt.Arch, ldr.Lookup("runtime.types", 0))
- moduledata.AddAddr(ctxt.Arch, ldr.Lookup("runtime.etypedesc", 0))
+ ctxt.moduledataTypeDescOffset = moduledata.Size()
+ moduledata.AddUint(ctxt.Arch, 0) // filled in by dodataSect
moduledata.AddAddr(ctxt.Arch, ldr.Lookup("runtime.etypes", 0))
moduledata.AddAddr(ctxt.Arch, ldr.Lookup("runtime.rodata", 0))
moduledata.AddAddr(ctxt.Arch, ldr.Lookup("go:func.*", 0))
findfunctab uintptr
minpc, maxpc uintptr
- text, etext uintptr
- noptrdata, enoptrdata uintptr
- data, edata uintptr
- bss, ebss uintptr
- noptrbss, enoptrbss uintptr
- covctrs, ecovctrs uintptr
- end, gcdata, gcbss uintptr
- types, etypedesc, etypes uintptr
- rodata uintptr
- gofunc uintptr // go.func.*
- epclntab uintptr
+ text, etext uintptr
+ noptrdata, enoptrdata uintptr
+ data, edata uintptr
+ bss, ebss uintptr
+ noptrbss, enoptrbss uintptr
+ covctrs, ecovctrs uintptr
+ end, gcdata, gcbss uintptr
+ types, typedesclen, etypes uintptr
+ rodata uintptr
+ gofunc uintptr // go.func.*
+ epclntab uintptr
textsectmap []textsect
itablinks []*itab