}
ptrsize := int64(SysArch.PtrSize)
- nptr := decodetype_ptrdata(p.ctxt.Arch, typ) / ptrsize
+ nptr := decodetypePtrdata(p.ctxt.Arch, typ) / ptrsize
if debugGCProg {
fmt.Fprintf(os.Stderr, "gcprog sym: %s at %d (ptr=%d+%d)\n", s.Name, s.Value, s.Value/ptrsize, nptr)
}
- if decodetype_usegcprog(typ) == 0 {
+ if decodetypeUsegcprog(typ) == 0 {
// Copy pointers from mask into program.
- mask := decodetype_gcmask(p.ctxt, typ)
+ mask := decodetypeGcmask(p.ctxt, typ)
for i := int64(0); i < nptr; i++ {
if (mask[i/8]>>uint(i%8))&1 != 0 {
p.w.Ptr(s.Value/ptrsize + i)
}
// Copy program.
- prog := decodetype_gcprog(p.ctxt, typ)
+ prog := decodetypeGcprog(p.ctxt, typ)
p.w.ZeroUntil(s.Value / ptrsize)
p.w.Append(prog[4:], nptr)
}
// situation.
// TODO(mwhudson): It would make sense to do this more widely, but it makes
// the system linker segfault on darwin.
- relro_perms := 04
- relro_prefix := ""
+ relroPerms := 04
+ relroPrefix := ""
if UseRelro() {
- relro_perms = 06
- relro_prefix = ".data.rel.ro"
+ relroPerms = 06
+ relroPrefix = ".data.rel.ro"
/* data only written by relocations */
sect = addsection(segro, ".data.rel.ro", 06)
}
/* typelink */
- sect = addsection(segro, relro_prefix+".typelink", relro_perms)
+ sect = addsection(segro, relroPrefix+".typelink", relroPerms)
sect.Align = dataMaxAlign[obj.STYPELINK]
datsize = Rnd(datsize, int64(sect.Align))
sect.Vaddr = uint64(datsize)
sect.Length = uint64(datsize) - sect.Vaddr
/* itablink */
- sect = addsection(segro, relro_prefix+".itablink", relro_perms)
+ sect = addsection(segro, relroPrefix+".itablink", relroPerms)
sect.Align = dataMaxAlign[obj.SITABLINK]
datsize = Rnd(datsize, int64(sect.Align))
sect.Vaddr = uint64(datsize)
sect.Length = uint64(datsize) - sect.Vaddr
/* gosymtab */
- sect = addsection(segro, relro_prefix+".gosymtab", relro_perms)
+ sect = addsection(segro, relroPrefix+".gosymtab", relroPerms)
sect.Align = dataMaxAlign[obj.SSYMTAB]
datsize = Rnd(datsize, int64(sect.Align))
sect.Vaddr = uint64(datsize)
sect.Length = uint64(datsize) - sect.Vaddr
/* gopclntab */
- sect = addsection(segro, relro_prefix+".gopclntab", relro_perms)
+ sect = addsection(segro, relroPrefix+".gopclntab", relroPerms)
sect.Align = dataMaxAlign[obj.SPCLNTAB]
datsize = Rnd(datsize, int64(sect.Align))
sect.Vaddr = uint64(datsize)
case obj.STYPELINK:
// Sort typelinks by the rtype.string field so the reflect
// package can binary search type links.
- symsSort[i].name = string(decodetype_str(s.R[0].Sym))
+ symsSort[i].name = string(decodetypeStr(s.R[0].Sym))
}
}
}
if strings.HasPrefix(s.Name, "type.") && s.Name[5] != '.' {
- if decodetype_kind(s)&kindMask == kindInterface {
- for _, sig := range decodetype_ifacemethods(d.ctxt.Arch, s) {
+ if decodetypeKind(s)&kindMask == kindInterface {
+ for _, sig := range decodeIfaceMethods(d.ctxt.Arch, s) {
if d.ctxt.Debugvlog > 1 {
fmt.Fprintf(d.ctxt.Bso, "reached iface method: %s\n", sig)
}
// Decode runtime type information for type methods
// to help work out which methods can be called
// dynamically via interfaces.
- methodsigs := decodetype_methods(d.ctxt.Arch, s)
+ methodsigs := decodetypeMethods(d.ctxt.Arch, s)
if len(methods) != len(methodsigs) {
panic(fmt.Sprintf("%q has %d method relocations for %d methods", s.Name, len(methods), len(methodsigs)))
}
tflagExtraStar = 1 << 1
)
-func decode_reloc(s *Symbol, off int32) *Reloc {
+func decodeReloc(s *Symbol, off int32) *Reloc {
for i := range s.R {
if s.R[i].Off == off {
return &s.R[i]
return nil
}
-func decode_reloc_sym(s *Symbol, off int32) *Symbol {
- r := decode_reloc(s, off)
+func decodeRelocSym(s *Symbol, off int32) *Symbol {
+ r := decodeReloc(s, off)
if r == nil {
return nil
}
return r.Sym
}
-func decode_inuxi(arch *sys.Arch, p []byte, sz int) uint64 {
+func decodeInuxi(arch *sys.Arch, p []byte, sz int) uint64 {
switch sz {
case 2:
return uint64(arch.ByteOrder.Uint16(p))
func uncommonSize() int { return 4 + 2 + 2 + 4 + 4 } // runtime.uncommontype
// Type.commonType.kind
-func decodetype_kind(s *Symbol) uint8 {
+func decodetypeKind(s *Symbol) uint8 {
return s.P[2*SysArch.PtrSize+7] & obj.KindMask // 0x13 / 0x1f
}
// Type.commonType.kind
-func decodetype_usegcprog(s *Symbol) uint8 {
+func decodetypeUsegcprog(s *Symbol) uint8 {
return s.P[2*SysArch.PtrSize+7] & obj.KindGCProg // 0x13 / 0x1f
}
// Type.commonType.size
-func decodetype_size(arch *sys.Arch, s *Symbol) int64 {
- return int64(decode_inuxi(arch, s.P, SysArch.PtrSize)) // 0x8 / 0x10
+func decodetypeSize(arch *sys.Arch, s *Symbol) int64 {
+ return int64(decodeInuxi(arch, s.P, SysArch.PtrSize)) // 0x8 / 0x10
}
// Type.commonType.ptrdata
-func decodetype_ptrdata(arch *sys.Arch, s *Symbol) int64 {
- return int64(decode_inuxi(arch, s.P[SysArch.PtrSize:], SysArch.PtrSize)) // 0x8 / 0x10
+func decodetypePtrdata(arch *sys.Arch, s *Symbol) int64 {
+ return int64(decodeInuxi(arch, s.P[SysArch.PtrSize:], SysArch.PtrSize)) // 0x8 / 0x10
}
// Type.commonType.tflag
-func decodetype_hasUncommon(s *Symbol) bool {
+func decodetypeHasUncommon(s *Symbol) bool {
return s.P[2*SysArch.PtrSize+4]&tflagUncommon != 0
}
}
// Type.commonType.gc
-func decodetype_gcprog(ctxt *Link, s *Symbol) []byte {
+func decodetypeGcprog(ctxt *Link, s *Symbol) []byte {
if s.Type == obj.SDYNIMPORT {
- addr := decodetype_gcprog_shlib(ctxt, s)
+ addr := decodetypeGcprogShlib(ctxt, s)
sect := findShlibSection(ctxt, s.File, addr)
if sect != nil {
// A gcprog is a 4-byte uint32 indicating length, followed by
Exitf("cannot find gcprog for %s", s.Name)
return nil
}
- return decode_reloc_sym(s, 2*int32(SysArch.PtrSize)+8+1*int32(SysArch.PtrSize)).P
+ return decodeRelocSym(s, 2*int32(SysArch.PtrSize)+8+1*int32(SysArch.PtrSize)).P
}
-func decodetype_gcprog_shlib(ctxt *Link, s *Symbol) uint64 {
+func decodetypeGcprogShlib(ctxt *Link, s *Symbol) uint64 {
if SysArch.Family == sys.ARM64 {
for _, shlib := range ctxt.Shlibs {
if shlib.Path == s.File {
- return shlib.gcdata_addresses[s]
+ return shlib.gcdataAddresses[s]
}
}
return 0
}
- return decode_inuxi(ctxt.Arch, s.P[2*int32(SysArch.PtrSize)+8+1*int32(SysArch.PtrSize):], SysArch.PtrSize)
+ return decodeInuxi(ctxt.Arch, s.P[2*int32(SysArch.PtrSize)+8+1*int32(SysArch.PtrSize):], SysArch.PtrSize)
}
-func decodetype_gcmask(ctxt *Link, s *Symbol) []byte {
+func decodetypeGcmask(ctxt *Link, s *Symbol) []byte {
if s.Type == obj.SDYNIMPORT {
- addr := decodetype_gcprog_shlib(ctxt, s)
- ptrdata := decodetype_ptrdata(ctxt.Arch, s)
+ addr := decodetypeGcprogShlib(ctxt, s)
+ ptrdata := decodetypePtrdata(ctxt.Arch, s)
sect := findShlibSection(ctxt, s.File, addr)
if sect != nil {
r := make([]byte, ptrdata/int64(SysArch.PtrSize))
Exitf("cannot find gcmask for %s", s.Name)
return nil
}
- mask := decode_reloc_sym(s, 2*int32(SysArch.PtrSize)+8+1*int32(SysArch.PtrSize))
+ mask := decodeRelocSym(s, 2*int32(SysArch.PtrSize)+8+1*int32(SysArch.PtrSize))
return mask.P
}
// Type.ArrayType.elem and Type.SliceType.Elem
-func decodetype_arrayelem(s *Symbol) *Symbol {
- return decode_reloc_sym(s, int32(commonsize())) // 0x1c / 0x30
+func decodetypeArrayElem(s *Symbol) *Symbol {
+ return decodeRelocSym(s, int32(commonsize())) // 0x1c / 0x30
}
-func decodetype_arraylen(arch *sys.Arch, s *Symbol) int64 {
- return int64(decode_inuxi(arch, s.P[commonsize()+2*SysArch.PtrSize:], SysArch.PtrSize))
+func decodetypeArrayLen(arch *sys.Arch, s *Symbol) int64 {
+ return int64(decodeInuxi(arch, s.P[commonsize()+2*SysArch.PtrSize:], SysArch.PtrSize))
}
// Type.PtrType.elem
-func decodetype_ptrelem(s *Symbol) *Symbol {
- return decode_reloc_sym(s, int32(commonsize())) // 0x1c / 0x30
+func decodetypePtrElem(s *Symbol) *Symbol {
+ return decodeRelocSym(s, int32(commonsize())) // 0x1c / 0x30
}
// Type.MapType.key, elem
-func decodetype_mapkey(s *Symbol) *Symbol {
- return decode_reloc_sym(s, int32(commonsize())) // 0x1c / 0x30
+func decodetypeMapKey(s *Symbol) *Symbol {
+ return decodeRelocSym(s, int32(commonsize())) // 0x1c / 0x30
}
-func decodetype_mapvalue(s *Symbol) *Symbol {
- return decode_reloc_sym(s, int32(commonsize())+int32(SysArch.PtrSize)) // 0x20 / 0x38
+func decodetypeMapValue(s *Symbol) *Symbol {
+ return decodeRelocSym(s, int32(commonsize())+int32(SysArch.PtrSize)) // 0x20 / 0x38
}
// Type.ChanType.elem
-func decodetype_chanelem(s *Symbol) *Symbol {
- return decode_reloc_sym(s, int32(commonsize())) // 0x1c / 0x30
+func decodetypeChanElem(s *Symbol) *Symbol {
+ return decodeRelocSym(s, int32(commonsize())) // 0x1c / 0x30
}
// Type.FuncType.dotdotdot
-func decodetype_funcdotdotdot(arch *sys.Arch, s *Symbol) bool {
- return uint16(decode_inuxi(arch, s.P[commonsize()+2:], 2))&(1<<15) != 0
+func decodetypeFuncDotdotdot(arch *sys.Arch, s *Symbol) bool {
+ return uint16(decodeInuxi(arch, s.P[commonsize()+2:], 2))&(1<<15) != 0
}
// Type.FuncType.inCount
-func decodetype_funcincount(arch *sys.Arch, s *Symbol) int {
- return int(decode_inuxi(arch, s.P[commonsize():], 2))
+func decodetypeFuncInCount(arch *sys.Arch, s *Symbol) int {
+ return int(decodeInuxi(arch, s.P[commonsize():], 2))
}
-func decodetype_funcoutcount(arch *sys.Arch, s *Symbol) int {
- return int(uint16(decode_inuxi(arch, s.P[commonsize()+2:], 2)) & (1<<15 - 1))
+func decodetypeFuncOutCount(arch *sys.Arch, s *Symbol) int {
+ return int(uint16(decodeInuxi(arch, s.P[commonsize()+2:], 2)) & (1<<15 - 1))
}
-func decodetype_funcintype(s *Symbol, i int) *Symbol {
+func decodetypeFuncInType(s *Symbol, i int) *Symbol {
uadd := commonsize() + 4
if SysArch.PtrSize == 8 {
uadd += 4
}
- if decodetype_hasUncommon(s) {
+ if decodetypeHasUncommon(s) {
uadd += uncommonSize()
}
- return decode_reloc_sym(s, int32(uadd+i*SysArch.PtrSize))
+ return decodeRelocSym(s, int32(uadd+i*SysArch.PtrSize))
}
-func decodetype_funcouttype(arch *sys.Arch, s *Symbol, i int) *Symbol {
- return decodetype_funcintype(s, i+decodetype_funcincount(arch, s))
+func decodetypeFuncOutType(arch *sys.Arch, s *Symbol, i int) *Symbol {
+ return decodetypeFuncInType(s, i+decodetypeFuncInCount(arch, s))
}
// Type.StructType.fields.Slice::length
-func decodetype_structfieldcount(arch *sys.Arch, s *Symbol) int {
- return int(decode_inuxi(arch, s.P[commonsize()+2*SysArch.PtrSize:], SysArch.IntSize))
+func decodetypeStructFieldCount(arch *sys.Arch, s *Symbol) int {
+ return int(decodeInuxi(arch, s.P[commonsize()+2*SysArch.PtrSize:], SysArch.IntSize))
}
-func decodetype_structfieldarrayoff(s *Symbol, i int) int {
+func decodetypeStructFieldArrayOff(s *Symbol, i int) int {
off := commonsize() + 2*SysArch.PtrSize + 2*SysArch.IntSize
- if decodetype_hasUncommon(s) {
+ if decodetypeHasUncommon(s) {
off += uncommonSize()
}
off += i * structfieldSize()
return off
}
-// decodetype_str returns the contents of an rtype's str field (a nameOff).
-func decodetype_str(s *Symbol) string {
- str := decodetype_name(s, 4*SysArch.PtrSize+8)
+// decodetypeStr returns the contents of an rtype's str field (a nameOff).
+func decodetypeStr(s *Symbol) string {
+ str := decodetypeName(s, 4*SysArch.PtrSize+8)
if s.P[2*SysArch.PtrSize+4]&tflagExtraStar != 0 {
return str[1:]
}
return str
}
-// decodetype_name decodes the name from a reflect.name.
-func decodetype_name(s *Symbol, off int) string {
- r := decode_reloc(s, int32(off))
+// decodetypeName decodes the name from a reflect.name.
+func decodetypeName(s *Symbol, off int) string {
+ r := decodeReloc(s, int32(off))
if r == nil {
return ""
}
return string(data[3 : 3+namelen])
}
-func decodetype_structfieldname(s *Symbol, i int) string {
- off := decodetype_structfieldarrayoff(s, i)
- return decodetype_name(s, off)
+func decodetypeStructFieldName(s *Symbol, i int) string {
+ off := decodetypeStructFieldArrayOff(s, i)
+ return decodetypeName(s, off)
}
-func decodetype_structfieldtype(s *Symbol, i int) *Symbol {
- off := decodetype_structfieldarrayoff(s, i)
- return decode_reloc_sym(s, int32(off+SysArch.PtrSize))
+func decodetypeStructFieldType(s *Symbol, i int) *Symbol {
+ off := decodetypeStructFieldArrayOff(s, i)
+ return decodeRelocSym(s, int32(off+SysArch.PtrSize))
}
-func decodetype_structfieldoffs(arch *sys.Arch, s *Symbol, i int) int64 {
- off := decodetype_structfieldarrayoff(s, i)
- return int64(decode_inuxi(arch, s.P[off+2*SysArch.PtrSize:], SysArch.IntSize))
+func decodetypeStructFieldOffs(arch *sys.Arch, s *Symbol, i int) int64 {
+ off := decodetypeStructFieldArrayOff(s, i)
+ return int64(decodeInuxi(arch, s.P[off+2*SysArch.PtrSize:], SysArch.IntSize))
}
// InterfaceType.methods.length
-func decodetype_ifacemethodcount(arch *sys.Arch, s *Symbol) int64 {
- return int64(decode_inuxi(arch, s.P[commonsize()+2*SysArch.PtrSize:], SysArch.IntSize))
+func decodetypeIfaceMethodCount(arch *sys.Arch, s *Symbol) int64 {
+ return int64(decodeInuxi(arch, s.P[commonsize()+2*SysArch.PtrSize:], SysArch.IntSize))
}
// methodsig is a fully qualified typed method signature, like
kindMask = (1 << 5) - 1
)
-// decode_methodsig decodes an array of method signature information.
+// decodeMethodSig decodes an array of method signature information.
// Each element of the array is size bytes. The first 4 bytes is a
// nameOff for the method name, and the next 4 bytes is a typeOff for
// the function type.
//
// Conveniently this is the layout of both runtime.method and runtime.imethod.
-func decode_methodsig(arch *sys.Arch, s *Symbol, off, size, count int) []methodsig {
+func decodeMethodSig(arch *sys.Arch, s *Symbol, off, size, count int) []methodsig {
var buf bytes.Buffer
var methods []methodsig
for i := 0; i < count; i++ {
- buf.WriteString(decodetype_name(s, off))
- mtypSym := decode_reloc_sym(s, int32(off+4))
+ buf.WriteString(decodetypeName(s, off))
+ mtypSym := decodeRelocSym(s, int32(off+4))
buf.WriteRune('(')
- inCount := decodetype_funcincount(arch, mtypSym)
+ inCount := decodetypeFuncInCount(arch, mtypSym)
for i := 0; i < inCount; i++ {
if i > 0 {
buf.WriteString(", ")
}
- buf.WriteString(decodetype_funcintype(mtypSym, i).Name)
+ buf.WriteString(decodetypeFuncInType(mtypSym, i).Name)
}
buf.WriteString(") (")
- outCount := decodetype_funcoutcount(arch, mtypSym)
+ outCount := decodetypeFuncOutCount(arch, mtypSym)
for i := 0; i < outCount; i++ {
if i > 0 {
buf.WriteString(", ")
}
- buf.WriteString(decodetype_funcouttype(arch, mtypSym, i).Name)
+ buf.WriteString(decodetypeFuncOutType(arch, mtypSym, i).Name)
}
buf.WriteRune(')')
return methods
}
-func decodetype_ifacemethods(arch *sys.Arch, s *Symbol) []methodsig {
- if decodetype_kind(s)&kindMask != kindInterface {
+func decodeIfaceMethods(arch *sys.Arch, s *Symbol) []methodsig {
+ if decodetypeKind(s)&kindMask != kindInterface {
panic(fmt.Sprintf("symbol %q is not an interface", s.Name))
}
- r := decode_reloc(s, int32(commonsize()+SysArch.PtrSize))
+ r := decodeReloc(s, int32(commonsize()+SysArch.PtrSize))
if r == nil {
return nil
}
panic(fmt.Sprintf("imethod slice pointer in %q leads to a different symbol", s.Name))
}
off := int(r.Add) // array of reflect.imethod values
- numMethods := int(decodetype_ifacemethodcount(arch, s))
+ numMethods := int(decodetypeIfaceMethodCount(arch, s))
sizeofIMethod := 4 + 4
- return decode_methodsig(arch, s, off, sizeofIMethod, numMethods)
+ return decodeMethodSig(arch, s, off, sizeofIMethod, numMethods)
}
-func decodetype_methods(arch *sys.Arch, s *Symbol) []methodsig {
- if !decodetype_hasUncommon(s) {
+func decodetypeMethods(arch *sys.Arch, s *Symbol) []methodsig {
+ if !decodetypeHasUncommon(s) {
panic(fmt.Sprintf("no methods on %q", s.Name))
}
off := commonsize() // reflect.rtype
- switch decodetype_kind(s) & kindMask {
+ switch decodetypeKind(s) & kindMask {
case kindStruct: // reflect.structType
off += 2*SysArch.PtrSize + 2*SysArch.IntSize
case kindPtr: // reflect.ptrType
// just Sizeof(rtype)
}
- mcount := int(decode_inuxi(arch, s.P[off+4:], 2))
- moff := int(decode_inuxi(arch, s.P[off+4+2+2:], 4))
+ mcount := int(decodeInuxi(arch, s.P[off+4:], 2))
+ moff := int(decodeInuxi(arch, s.P[off+4+2+2:], 4))
off += moff // offset to array of reflect.method values
const sizeofMethod = 4 * 4 // sizeof reflect.method in program
- return decode_methodsig(arch, s, off, sizeofMethod, mcount)
+ return decodeMethodSig(arch, s, off, sizeofMethod, mcount)
}
}
// Lookup predefined types
-func lookup_or_diag(ctxt *Link, n string) *Symbol {
+func lookupOrDiag(ctxt *Link, n string) *Symbol {
s := Linkrlookup(ctxt, n, 0)
if s == nil || s.Size == 0 {
Exitf("dwarf: missing type: %s", n)
func newtype(ctxt *Link, gotype *Symbol) *dwarf.DWDie {
name := gotype.Name[5:] // could also decode from Type.string
- kind := decodetype_kind(gotype)
- bytesize := decodetype_size(ctxt.Arch, gotype)
+ kind := decodetypeKind(gotype)
+ bytesize := decodetypeSize(ctxt.Arch, gotype)
var die *dwarf.DWDie
switch kind {
die = newdie(ctxt, &dwtypes, dwarf.DW_ABRV_ARRAYTYPE, name, 0)
dotypedef(ctxt, &dwtypes, name, die)
newattr(die, dwarf.DW_AT_byte_size, dwarf.DW_CLS_CONSTANT, bytesize, 0)
- s := decodetype_arrayelem(gotype)
+ s := decodetypeArrayElem(gotype)
newrefattr(die, dwarf.DW_AT_type, defgotype(ctxt, s))
fld := newdie(ctxt, die, dwarf.DW_ABRV_ARRAYRANGE, "range", 0)
// use actual length not upper bound; correct for 0-length arrays.
- newattr(fld, dwarf.DW_AT_count, dwarf.DW_CLS_CONSTANT, decodetype_arraylen(ctxt.Arch, gotype), 0)
+ newattr(fld, dwarf.DW_AT_count, dwarf.DW_CLS_CONSTANT, decodetypeArrayLen(ctxt.Arch, gotype), 0)
newrefattr(fld, dwarf.DW_AT_type, mustFind(ctxt, "uintptr"))
case obj.KindChan:
die = newdie(ctxt, &dwtypes, dwarf.DW_ABRV_CHANTYPE, name, 0)
newattr(die, dwarf.DW_AT_byte_size, dwarf.DW_CLS_CONSTANT, bytesize, 0)
- s := decodetype_chanelem(gotype)
+ s := decodetypeChanElem(gotype)
newrefattr(die, dwarf.DW_AT_go_elem, defgotype(ctxt, s))
// Save elem type for synthesizechantypes. We could synthesize here
// but that would change the order of DIEs we output.
die = newdie(ctxt, &dwtypes, dwarf.DW_ABRV_FUNCTYPE, name, 0)
dotypedef(ctxt, &dwtypes, name, die)
newrefattr(die, dwarf.DW_AT_type, mustFind(ctxt, "void"))
- nfields := decodetype_funcincount(ctxt.Arch, gotype)
+ nfields := decodetypeFuncInCount(ctxt.Arch, gotype)
var fld *dwarf.DWDie
var s *Symbol
for i := 0; i < nfields; i++ {
- s = decodetype_funcintype(gotype, i)
+ s = decodetypeFuncInType(gotype, i)
fld = newdie(ctxt, die, dwarf.DW_ABRV_FUNCTYPEPARAM, s.Name[5:], 0)
newrefattr(fld, dwarf.DW_AT_type, defgotype(ctxt, s))
}
- if decodetype_funcdotdotdot(ctxt.Arch, gotype) {
+ if decodetypeFuncDotdotdot(ctxt.Arch, gotype) {
newdie(ctxt, die, dwarf.DW_ABRV_DOTDOTDOT, "...", 0)
}
- nfields = decodetype_funcoutcount(ctxt.Arch, gotype)
+ nfields = decodetypeFuncOutCount(ctxt.Arch, gotype)
for i := 0; i < nfields; i++ {
- s = decodetype_funcouttype(ctxt.Arch, gotype, i)
+ s = decodetypeFuncOutType(ctxt.Arch, gotype, i)
fld = newdie(ctxt, die, dwarf.DW_ABRV_FUNCTYPEPARAM, s.Name[5:], 0)
newrefattr(fld, dwarf.DW_AT_type, defptrto(ctxt, defgotype(ctxt, s)))
}
die = newdie(ctxt, &dwtypes, dwarf.DW_ABRV_IFACETYPE, name, 0)
dotypedef(ctxt, &dwtypes, name, die)
newattr(die, dwarf.DW_AT_byte_size, dwarf.DW_CLS_CONSTANT, bytesize, 0)
- nfields := int(decodetype_ifacemethodcount(ctxt.Arch, gotype))
+ nfields := int(decodetypeIfaceMethodCount(ctxt.Arch, gotype))
var s *Symbol
if nfields == 0 {
- s = lookup_or_diag(ctxt, "type.runtime.eface")
+ s = lookupOrDiag(ctxt, "type.runtime.eface")
} else {
- s = lookup_or_diag(ctxt, "type.runtime.iface")
+ s = lookupOrDiag(ctxt, "type.runtime.iface")
}
newrefattr(die, dwarf.DW_AT_type, defgotype(ctxt, s))
case obj.KindMap:
die = newdie(ctxt, &dwtypes, dwarf.DW_ABRV_MAPTYPE, name, 0)
- s := decodetype_mapkey(gotype)
+ s := decodetypeMapKey(gotype)
newrefattr(die, dwarf.DW_AT_go_key, defgotype(ctxt, s))
- s = decodetype_mapvalue(gotype)
+ s = decodetypeMapValue(gotype)
newrefattr(die, dwarf.DW_AT_go_elem, defgotype(ctxt, s))
// Save gotype for use in synthesizemaptypes. We could synthesize here,
// but that would change the order of the DIEs.
case obj.KindPtr:
die = newdie(ctxt, &dwtypes, dwarf.DW_ABRV_PTRTYPE, name, 0)
dotypedef(ctxt, &dwtypes, name, die)
- s := decodetype_ptrelem(gotype)
+ s := decodetypePtrElem(gotype)
newrefattr(die, dwarf.DW_AT_type, defgotype(ctxt, s))
case obj.KindSlice:
die = newdie(ctxt, &dwtypes, dwarf.DW_ABRV_SLICETYPE, name, 0)
dotypedef(ctxt, &dwtypes, name, die)
newattr(die, dwarf.DW_AT_byte_size, dwarf.DW_CLS_CONSTANT, bytesize, 0)
- s := decodetype_arrayelem(gotype)
+ s := decodetypeArrayElem(gotype)
elem := defgotype(ctxt, s)
newrefattr(die, dwarf.DW_AT_go_elem, elem)
die = newdie(ctxt, &dwtypes, dwarf.DW_ABRV_STRUCTTYPE, name, 0)
dotypedef(ctxt, &dwtypes, name, die)
newattr(die, dwarf.DW_AT_byte_size, dwarf.DW_CLS_CONSTANT, bytesize, 0)
- nfields := decodetype_structfieldcount(ctxt.Arch, gotype)
+ nfields := decodetypeStructFieldCount(ctxt.Arch, gotype)
var f string
var fld *dwarf.DWDie
var s *Symbol
for i := 0; i < nfields; i++ {
- f = decodetype_structfieldname(gotype, i)
- s = decodetype_structfieldtype(gotype, i)
+ f = decodetypeStructFieldName(gotype, i)
+ s = decodetypeStructFieldType(gotype, i)
if f == "" {
f = s.Name[5:] // skip "type."
}
fld = newdie(ctxt, die, dwarf.DW_ABRV_STRUCTFIELD, f, 0)
newrefattr(fld, dwarf.DW_AT_type, defgotype(ctxt, s))
- newmemberoffsetattr(fld, int32(decodetype_structfieldoffs(ctxt.Arch, gotype, i)))
+ newmemberoffsetattr(fld, int32(decodetypeStructFieldOffs(ctxt.Arch, gotype, i)))
}
case obj.KindUnsafePointer:
func findprotodie(ctxt *Link, name string) *dwarf.DWDie {
die, ok := prototypedies[name]
if ok && die == nil {
- defgotype(ctxt, lookup_or_diag(ctxt, name))
+ defgotype(ctxt, lookupOrDiag(ctxt, name))
die = prototypedies[name]
}
return die
continue
}
gotype := getattr(die, dwarf.DW_AT_type).Data.(*Symbol)
- keytype := decodetype_mapkey(gotype)
- valtype := decodetype_mapvalue(gotype)
- keysize, valsize := decodetype_size(ctxt.Arch, keytype), decodetype_size(ctxt.Arch, valtype)
+ keytype := decodetypeMapKey(gotype)
+ valtype := decodetypeMapValue(gotype)
+ keysize, valsize := decodetypeSize(ctxt.Arch, keytype), decodetypeSize(ctxt.Arch, valtype)
keytype, valtype = walksymtypedef(ctxt, defgotype(ctxt, keytype)), walksymtypedef(ctxt, defgotype(ctxt, valtype))
// compute size info like hashmap.c does.
- indirect_key, indirect_val := false, false
+ indirectKey, indirectVal := false, false
if keysize > MaxKeySize {
keysize = int64(SysArch.PtrSize)
- indirect_key = true
+ indirectKey = true
}
if valsize > MaxValSize {
valsize = int64(SysArch.PtrSize)
- indirect_val = true
+ indirectVal = true
}
// Construct type to represent an array of BucketSize keys
dwhks := mkinternaltype(ctxt, dwarf.DW_ABRV_ARRAYTYPE, "[]key", keyname, "", func(dwhk *dwarf.DWDie) {
newattr(dwhk, dwarf.DW_AT_byte_size, dwarf.DW_CLS_CONSTANT, BucketSize*keysize, 0)
t := keytype
- if indirect_key {
+ if indirectKey {
t = defptrto(ctxt, keytype)
}
newrefattr(dwhk, dwarf.DW_AT_type, t)
dwhvs := mkinternaltype(ctxt, dwarf.DW_ABRV_ARRAYTYPE, "[]val", valname, "", func(dwhv *dwarf.DWDie) {
newattr(dwhv, dwarf.DW_AT_byte_size, dwarf.DW_CLS_CONSTANT, BucketSize*valsize, 0)
t := valtype
- if indirect_val {
+ if indirectVal {
t = defptrto(ctxt, valtype)
}
newrefattr(dwhv, dwarf.DW_AT_type, t)
continue
}
elemgotype := getattr(die, dwarf.DW_AT_type).Data.(*Symbol)
- elemsize := decodetype_size(ctxt.Arch, elemgotype)
+ elemsize := decodetypeSize(ctxt.Arch, elemgotype)
elemname := elemgotype.Name[5:]
elemtype := walksymtypedef(ctxt, defgotype(ctxt, elemgotype))
OPCODE_BASE = 10
)
-func putpclcdelta(linkctxt *Link, ctxt dwarf.Context, s *Symbol, delta_pc int64, delta_lc int64) {
- if LINE_BASE <= delta_lc && delta_lc < LINE_BASE+LINE_RANGE {
- var opcode int64 = OPCODE_BASE + (delta_lc - LINE_BASE) + (LINE_RANGE * delta_pc)
+func putpclcdelta(linkctxt *Link, ctxt dwarf.Context, s *Symbol, deltaPC int64, deltaLC int64) {
+ if LINE_BASE <= deltaLC && deltaLC < LINE_BASE+LINE_RANGE {
+ var opcode int64 = OPCODE_BASE + (deltaLC - LINE_BASE) + (LINE_RANGE * deltaPC)
if OPCODE_BASE <= opcode && opcode < 256 {
Adduint8(linkctxt, s, uint8(opcode))
return
}
}
- if delta_pc != 0 {
+ if deltaPC != 0 {
Adduint8(linkctxt, s, dwarf.DW_LNS_advance_pc)
- dwarf.Sleb128put(ctxt, s, delta_pc)
+ dwarf.Sleb128put(ctxt, s, deltaPC)
}
Adduint8(linkctxt, s, dwarf.DW_LNS_advance_line)
- dwarf.Sleb128put(ctxt, s, delta_lc)
+ dwarf.Sleb128put(ctxt, s, deltaLC)
Adduint8(linkctxt, s, dwarf.DW_LNS_copy)
}
// Write .debug_line Line Number Program Header (sec 6.2.4)
// Fields marked with (*) must be changed for 64-bit dwarf
- unit_length_offset := ls.Size
+ unitLengthOffset := ls.Size
Adduint32(ctxt, ls, 0) // unit_length (*), filled in at end.
unitstart = ls.Size
Adduint16(ctxt, ls, 2) // dwarf version (appendix F)
- header_length_offset := ls.Size
+ headerLengthOffset := ls.Size
Adduint32(ctxt, ls, 0) // header_length (*), filled in at end.
headerstart = ls.Size
newattr(dwinfo, dwarf.DW_AT_high_pc, dwarf.DW_CLS_ADDRESS, epc+1, epcs)
- setuint32(ctxt, ls, unit_length_offset, uint32(ls.Size-unitstart))
- setuint32(ctxt, ls, header_length_offset, uint32(headerend-headerstart))
+ setuint32(ctxt, ls, unitLengthOffset, uint32(ls.Size-unitstart))
+ setuint32(ctxt, ls, headerLengthOffset, uint32(headerend-headerstart))
return syms, funcs
}
}
// Needed by the prettyprinter code for interface inspection.
- defgotype(ctxt, lookup_or_diag(ctxt, "type.runtime._type"))
+ defgotype(ctxt, lookupOrDiag(ctxt, "type.runtime._type"))
- defgotype(ctxt, lookup_or_diag(ctxt, "type.runtime.interfacetype"))
- defgotype(ctxt, lookup_or_diag(ctxt, "type.runtime.itab"))
+ defgotype(ctxt, lookupOrDiag(ctxt, "type.runtime.interfacetype"))
+ defgotype(ctxt, lookupOrDiag(ctxt, "type.runtime.itab"))
genasmsym(ctxt, defdwsymb)
* padded to a word boundary. The values of n_namesz and n_descsz do
* not include the padding.
*/
-type Elf_Note struct {
- n_namesz uint32
- n_descsz uint32
- n_type uint32
+type elfNote struct {
+ nNamesz uint32
+ nDescsz uint32
+ nType uint32
}
const (
var ElfMagic = [4]uint8{0x7F, 'E', 'L', 'F'}
const (
- Tag_file = 1
- Tag_CPU_name = 4
- Tag_CPU_raw_name = 5
- Tag_compatibility = 32
- Tag_nodefaults = 64
- Tag_also_compatible_with = 65
- Tag_ABI_VFP_args = 28
+ TagFile = 1
+ TagCPUName = 4
+ TagCPURawName = 5
+ TagCompatibility = 32
+ TagNoDefaults = 64
+ TagAlsoCompatibleWith = 65
+ TagABIVFPArgs = 28
)
type elfAttribute struct {
func (a *elfAttributeList) armAttr() elfAttribute {
attr := elfAttribute{tag: a.uleb128()}
switch {
- case attr.tag == Tag_compatibility:
+ case attr.tag == TagCompatibility:
attr.ival = a.uleb128()
attr.sval = a.string()
attr.sval = a.string()
// Tag with string argument
- case attr.tag == Tag_CPU_name || attr.tag == Tag_CPU_raw_name || (attr.tag >= 32 && attr.tag&1 != 0):
+ case attr.tag == TagCPUName || attr.tag == TagCPURawName || (attr.tag >= 32 && attr.tag&1 != 0):
attr.sval = a.string()
default: // Tag with integer argument
subsectiondata := sectiondata[sz+4 : subsectionsize]
sectiondata = sectiondata[subsectionsize:]
- if subsectiontag == Tag_file {
+ if subsectiontag == TagFile {
attrList := elfAttributeList{data: subsectiondata}
for !attrList.done() {
attr := attrList.armAttr()
- if attr.tag == Tag_ABI_VFP_args && attr.ival == 1 {
+ if attr.tag == TagABIVFPArgs && attr.ival == 1 {
ehdr.flags = 0x5000402 // has entry point, Version5 EABI, hard-float ABI
}
}
N_STAB = 0xe0
)
-type LdMachoObj struct {
+type ldMachoObj struct {
f *bio.Reader
base int64 // off in f where Mach-O begins
length int64 // length of Mach-O
subcputype uint
filetype uint32
flags uint32
- cmd []LdMachoCmd
+ cmd []ldMachoCmd
ncmd uint
}
-type LdMachoCmd struct {
+type ldMachoCmd struct {
type_ int
off uint32
size uint32
- seg LdMachoSeg
- sym LdMachoSymtab
- dsym LdMachoDysymtab
+ seg ldMachoSeg
+ sym ldMachoSymtab
+ dsym ldMachoDysymtab
}
-type LdMachoSeg struct {
+type ldMachoSeg struct {
name string
vmaddr uint64
vmsize uint64
initprot uint32
nsect uint32
flags uint32
- sect []LdMachoSect
+ sect []ldMachoSect
}
-type LdMachoSect struct {
+type ldMachoSect struct {
name string
segname string
addr uint64
res1 uint32
res2 uint32
sym *Symbol
- rel []LdMachoRel
+ rel []ldMachoRel
}
-type LdMachoRel struct {
+type ldMachoRel struct {
addr uint32
symnum uint32
pcrel uint8
value uint32
}
-type LdMachoSymtab struct {
+type ldMachoSymtab struct {
symoff uint32
nsym uint32
stroff uint32
strsize uint32
str []byte
- sym []LdMachoSym
+ sym []ldMachoSym
}
-type LdMachoSym struct {
+type ldMachoSym struct {
name string
type_ uint8
sectnum uint8
sym *Symbol
}
-type LdMachoDysymtab struct {
+type ldMachoDysymtab struct {
ilocalsym uint32
nlocalsym uint32
iextdefsym uint32
LdMachoFilePreload = 5
)
-func unpackcmd(p []byte, m *LdMachoObj, c *LdMachoCmd, type_ uint, sz uint) int {
+func unpackcmd(p []byte, m *ldMachoObj, c *ldMachoCmd, type_ uint, sz uint) int {
e4 := m.e.Uint32
e8 := m.e.Uint64
c.seg.initprot = e4(p[44:])
c.seg.nsect = e4(p[48:])
c.seg.flags = e4(p[52:])
- c.seg.sect = make([]LdMachoSect, c.seg.nsect)
+ c.seg.sect = make([]ldMachoSect, c.seg.nsect)
if uint32(sz) < 56+c.seg.nsect*68 {
return -1
}
p = p[56:]
- var s *LdMachoSect
+ var s *ldMachoSect
for i := 0; uint32(i) < c.seg.nsect; i++ {
s = &c.seg.sect[i]
s.name = cstring(p[0:16])
c.seg.initprot = e4(p[60:])
c.seg.nsect = e4(p[64:])
c.seg.flags = e4(p[68:])
- c.seg.sect = make([]LdMachoSect, c.seg.nsect)
+ c.seg.sect = make([]ldMachoSect, c.seg.nsect)
if uint32(sz) < 72+c.seg.nsect*80 {
return -1
}
p = p[72:]
- var s *LdMachoSect
+ var s *ldMachoSect
for i := 0; uint32(i) < c.seg.nsect; i++ {
s = &c.seg.sect[i]
s.name = cstring(p[0:16])
return 0
}
-func macholoadrel(m *LdMachoObj, sect *LdMachoSect) int {
+func macholoadrel(m *ldMachoObj, sect *ldMachoSect) int {
if sect.rel != nil || sect.nreloc == 0 {
return 0
}
- rel := make([]LdMachoRel, sect.nreloc)
+ rel := make([]ldMachoRel, sect.nreloc)
n := int(sect.nreloc * 8)
buf := make([]byte, n)
if m.f.Seek(m.base+int64(sect.reloff), 0) < 0 {
return -1
}
var p []byte
- var r *LdMachoRel
+ var r *ldMachoRel
var v uint32
for i := 0; uint32(i) < sect.nreloc; i++ {
r = &rel[i]
return 0
}
-func macholoaddsym(m *LdMachoObj, d *LdMachoDysymtab) int {
+func macholoaddsym(m *ldMachoObj, d *ldMachoDysymtab) int {
n := int(d.nindirectsyms)
p := make([]byte, n*4)
return 0
}
-func macholoadsym(m *LdMachoObj, symtab *LdMachoSymtab) int {
+func macholoadsym(m *ldMachoObj, symtab *ldMachoSymtab) int {
if symtab.sym != nil {
return 0
}
if _, err := io.ReadFull(m.f, symbuf); err != nil {
return -1
}
- sym := make([]LdMachoSym, symtab.nsym)
+ sym := make([]ldMachoSym, symtab.nsym)
p := symbuf
- var s *LdMachoSym
+ var s *ldMachoSym
var v uint32
for i := 0; uint32(i) < symtab.nsym; i++ {
s = &sym[i]
var ty uint32
var sz uint32
var off uint32
- var m *LdMachoObj
+ var m *ldMachoObj
var e binary.ByteOrder
- var sect *LdMachoSect
- var rel *LdMachoRel
+ var sect *ldMachoSect
+ var rel *ldMachoRel
var rpi int
var s *Symbol
var s1 *Symbol
var outer *Symbol
- var c *LdMachoCmd
- var symtab *LdMachoSymtab
- var dsymtab *LdMachoDysymtab
- var sym *LdMachoSym
+ var c *ldMachoCmd
+ var symtab *ldMachoSymtab
+ var dsymtab *ldMachoDysymtab
+ var sym *ldMachoSym
var r []Reloc
var rp *Reloc
var name string
f.Seek(4, 1) // skip reserved word in header
}
- m = new(LdMachoObj)
+ m = new(ldMachoObj)
m.f = f
m.e = e
}
}
- m.cmd = make([]LdMachoCmd, ncmd)
+ m.cmd = make([]ldMachoCmd, ncmd)
off = uint32(len(hdr))
cmdp = make([]byte, cmdsz)
if _, err2 := io.ReadFull(f, cmdp); err2 != nil {
// now consider the desired symbol.
// find the section where it lives.
- var ks *LdMachoSect
+ var ks *ldMachoSect
for k := 0; uint32(k) < c.seg.nsect; k++ {
ks = &c.seg.sect[k]
if ks.addr <= uint64(rel.value) && uint64(rel.value) < ks.addr+ks.size {
ctxt.Diag("cannot read symbols from shared library: %s", libpath)
return
}
- gcdata_locations := make(map[uint64]*Symbol)
+ gcdataLocations := make(map[uint64]*Symbol)
for _, elfsym := range syms {
if elf.ST_TYPE(elfsym.Info) == elf.STT_NOTYPE || elf.ST_TYPE(elfsym.Info) == elf.STT_SECTION {
continue
// the type data.
if strings.HasPrefix(lsym.Name, "type.") && !strings.HasPrefix(lsym.Name, "type..") {
lsym.P = readelfsymboldata(ctxt, f, &elfsym)
- gcdata_locations[elfsym.Value+2*uint64(SysArch.PtrSize)+8+1*uint64(SysArch.PtrSize)] = lsym
+ gcdataLocations[elfsym.Value+2*uint64(SysArch.PtrSize)+8+1*uint64(SysArch.PtrSize)] = lsym
}
}
}
- gcdata_addresses := make(map[*Symbol]uint64)
+ gcdataAddresses := make(map[*Symbol]uint64)
if SysArch.Family == sys.ARM64 {
for _, sect := range f.Sections {
if sect.Type == elf.SHT_RELA {
if t != elf.R_AARCH64_RELATIVE {
continue
}
- if lsym, ok := gcdata_locations[rela.Off]; ok {
- gcdata_addresses[lsym] = uint64(rela.Addend)
+ if lsym, ok := gcdataLocations[rela.Off]; ok {
+ gcdataAddresses[lsym] = uint64(rela.Addend)
}
}
}
}
ctxt.Textp = textp
- ctxt.Shlibs = append(ctxt.Shlibs, Shlib{Path: libpath, Hash: hash, Deps: deps, File: f, gcdata_addresses: gcdata_addresses})
+ ctxt.Shlibs = append(ctxt.Shlibs, Shlib{Path: libpath, Hash: hash, Deps: deps, File: f, gcdataAddresses: gcdataAddresses})
}
func mywhatsys() {
return uint32(b[0])<<24 | uint32(b[1])<<16 | uint32(b[2])<<8 | uint32(b[3])
}
-type Chain struct {
+type chain struct {
sym *Symbol
- up *Chain
+ up *chain
limit int // limit on entry to sym
}
}
func (ctxt *Link) dostkcheck() {
- var ch Chain
+ var ch chain
morestack = Linklookup(ctxt, "runtime.morestack", 0)
}
}
-func stkcheck(ctxt *Link, up *Chain, depth int) int {
+func stkcheck(ctxt *Link, up *chain, depth int) int {
limit := up.limit
s := up.sym
return 0
}
- var ch Chain
+ var ch chain
ch.up = up
if !s.Attr.NoSplit() {
ri := 0
endr := len(s.R)
- var ch1 Chain
+ var ch1 chain
var pcsp Pciter
var r *Reloc
for pciterinit(ctxt, &pcsp, &s.FuncInfo.Pcsp); pcsp.done == 0; pciternext(&pcsp) {
return 0
}
-func stkbroke(ctxt *Link, ch *Chain, limit int) {
+func stkbroke(ctxt *Link, ch *chain, limit int) {
ctxt.Diag("nosplit stack overflow")
stkprint(ctxt, ch, limit)
}
-func stkprint(ctxt *Link, ch *Chain, limit int) {
+func stkprint(ctxt *Link, ch *chain, limit int) {
var name string
if ch.sym != nil {
}
type Shlib struct {
- Path string
- Hash []byte
- Deps []string
- File *elf.File
- gcdata_addresses map[*Symbol]uint64
+ Path string
+ Hash []byte
+ Deps []string
+ File *elf.File
+ gcdataAddresses map[*Symbol]uint64
}
type Link struct {
// "big enough" header size. The initial header is
// one page, the non-dynamic library stuff takes
// up about 1300 bytes; we overestimate that as 2k.
-var load_budget int = INITIAL_MACHO_HEADR - 2*1024
+var loadBudget int = INITIAL_MACHO_HEADR - 2*1024
func Machoinit() {
macho64 = SysArch.RegSize == 8
// and 24 bytes of header metadata. If not enough
// space, grab another page of initial space at the
// beginning of the output file.
- load_budget -= (len(lib)+7)/8*8 + 24
+ loadBudget -= (len(lib)+7)/8*8 + 24
- if load_budget < 0 {
+ if loadBudget < 0 {
HEADR += 4096
*FlagTextAddr += 4096
- load_budget += 4096
+ loadBudget += 4096
}
dylib = append(dylib, lib)
// pclntab initializes the pclntab symbol with
// runtime function and file name information.
-var pclntab_zpcln FuncInfo
+var pclntabZpcln FuncInfo
// These variables are used to initialize runtime.firstmoduledata, see symtab.go:symtab.
var pclntabNfunc int32
var pclntabLastFunc *Symbol
func (ctxt *Link) pclntab() {
- funcdata_bytes := int64(0)
+ funcdataBytes := int64(0)
ftab := Linklookup(ctxt, "runtime.pclntab", 0)
ftab.Type = obj.SPCLNTAB
ftab.Attr |= AttrReachable
}
pcln := ctxt.Cursym.FuncInfo
if pcln == nil {
- pcln = &pclntab_zpcln
+ pcln = &pclntabZpcln
}
if pclntabFirstFunc == nil {
// TODO: Remove entirely.
off = int32(setuint32(ctxt, ftab, int64(off), 0x1234567))
- if pcln != &pclntab_zpcln {
+ if pcln != &pclntabZpcln {
renumberfiles(ctxt, pcln.File, &pcln.Pcfile)
if false {
// Sanity check the new numbering
setuintxx(ctxt, ftab, int64(off)+int64(SysArch.PtrSize)*int64(i), uint64(pcln.Funcdataoff[i]), int64(SysArch.PtrSize))
} else {
// TODO: Dedup.
- funcdata_bytes += pcln.Funcdata[i].Size
+ funcdataBytes += pcln.Funcdata[i].Size
setaddrplus(ctxt, ftab, int64(off)+int64(SysArch.PtrSize)*int64(i), pcln.Funcdata[i], pcln.Funcdataoff[i])
}
ftab.Size = int64(len(ftab.P))
if ctxt.Debugvlog != 0 {
- fmt.Fprintf(ctxt.Bso, "%5.2f pclntab=%d bytes, funcdata total %d bytes\n", obj.Cputime(), ftab.Size, funcdata_bytes)
+ fmt.Fprintf(ctxt.Bso, "%5.2f pclntab=%d bytes, funcdata total %d bytes\n", obj.Cputime(), ftab.Size, funcdataBytes)
}
}
dd[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress = uint32(va)
dd[IMAGE_DIRECTORY_ENTRY_EXPORT].Size = sect.VirtualSize
- va_name := va + binary.Size(&e) + nexport*4
- va_addr := va + binary.Size(&e)
- va_na := va + binary.Size(&e) + nexport*8
+ vaName := va + binary.Size(&e) + nexport*4
+ vaAddr := va + binary.Size(&e)
+ vaNa := va + binary.Size(&e) + nexport*8
e.Characteristics = 0
e.MajorVersion = 0
e.NumberOfNames = uint32(nexport)
e.Name = uint32(va+binary.Size(&e)) + uint32(nexport)*10 // Program names.
e.Base = 1
- e.AddressOfFunctions = uint32(va_addr)
- e.AddressOfNames = uint32(va_name)
- e.AddressOfNameOrdinals = uint32(va_na)
+ e.AddressOfFunctions = uint32(vaAddr)
+ e.AddressOfNames = uint32(vaName)
+ e.AddressOfNameOrdinals = uint32(vaNa)
// put IMAGE_EXPORT_DIRECTORY
binary.Write(&coutbuf, binary.LittleEndian, &e)
// creating the moduledata from scratch and it does not have a
// compiler-provided size, so read it from the type data.
moduledatatype := Linkrlookup(ctxt, "type.runtime.moduledata", 0)
- moduledata.Size = decodetype_size(ctxt.Arch, moduledatatype)
+ moduledata.Size = decodetypeSize(ctxt.Arch, moduledatatype)
Symgrow(ctxt, moduledata, moduledata.Size)
lastmoduledatap := Linklookup(ctxt, "runtime.lastmoduledatap", 0)