1
0
mirror of https://github.com/golang/go synced 2024-11-05 16:16:11 -07:00

cmd/link: cleanup after IntSize->PtrSize conversion

Passes toolstash-check -all.

Updates #19954.

Change-Id: Ic162306eed105912491bf1df47e32c32653f824c
Reviewed-on: https://go-review.googlesource.com/41490
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Matthew Dempsky 2017-04-21 19:05:38 -07:00
parent 2a18cc10b1
commit 06e5749f01
4 changed files with 13 additions and 9 deletions

View File

@ -140,6 +140,10 @@ func setuint32(ctxt *Link, s *Symbol, r int64, v uint32) int64 {
return setuintxx(ctxt, s, r, uint64(v), 4)
}
func setuint(ctxt *Link, s *Symbol, r int64, v uint64) int64 {
return setuintxx(ctxt, s, r, v, int64(SysArch.PtrSize))
}
func Addaddrplus(ctxt *Link, s *Symbol, t *Symbol, add int64) int64 {
if s.Type == 0 {
s.Type = objabi.SDATA

View File

@ -214,7 +214,7 @@ func decodetypeStructFieldCount(arch *sys.Arch, s *Symbol) int {
}
func decodetypeStructFieldArrayOff(s *Symbol, i int) int {
off := commonsize() + 2*SysArch.PtrSize + 2*SysArch.PtrSize
off := commonsize() + 4*SysArch.PtrSize
if decodetypeHasUncommon(s) {
off += uncommonSize()
}
@ -342,7 +342,7 @@ func decodetypeMethods(arch *sys.Arch, s *Symbol) []methodsig {
off := commonsize() // reflect.rtype
switch decodetypeKind(s) & kindMask {
case kindStruct: // reflect.structType
off += 2*SysArch.PtrSize + 2*SysArch.PtrSize
off += 4 * SysArch.PtrSize
case kindPtr: // reflect.ptrType
off += SysArch.PtrSize
case kindFunc: // reflect.funcType
@ -356,7 +356,7 @@ func decodetypeMethods(arch *sys.Arch, s *Symbol) []methodsig {
case kindMap: // reflect.mapType
off += 4*SysArch.PtrSize + 8
case kindInterface: // reflect.interfaceType
off += SysArch.PtrSize + 2*SysArch.PtrSize
off += 3 * SysArch.PtrSize
default:
// just Sizeof(rtype)
}

View File

@ -230,7 +230,7 @@ func (ctxt *Link) pclntab() {
setuint32(ctxt, ftab, 0, 0xfffffffb)
setuint8(ctxt, ftab, 6, uint8(SysArch.MinLC))
setuint8(ctxt, ftab, 7, uint8(SysArch.PtrSize))
setuintxx(ctxt, ftab, 8, uint64(nfunc), int64(SysArch.PtrSize))
setuint(ctxt, ftab, 8, uint64(nfunc))
pclntabPclntabOffset = int32(8 + SysArch.PtrSize)
funcnameoff := make(map[string]int32)
@ -282,7 +282,7 @@ func (ctxt *Link) pclntab() {
funcstart += int32(-len(ftab.P)) & (int32(SysArch.PtrSize) - 1)
setaddr(ctxt, ftab, 8+int64(SysArch.PtrSize)+int64(nfunc)*2*int64(SysArch.PtrSize), s)
setuintxx(ctxt, ftab, 8+int64(SysArch.PtrSize)+int64(nfunc)*2*int64(SysArch.PtrSize)+int64(SysArch.PtrSize), uint64(funcstart), int64(SysArch.PtrSize))
setuint(ctxt, ftab, 8+int64(SysArch.PtrSize)+int64(nfunc)*2*int64(SysArch.PtrSize)+int64(SysArch.PtrSize), uint64(funcstart))
// Write runtime._func. Keep in sync with ../../../../runtime/runtime2.go:/_func
// and package debug/gosym.
@ -375,7 +375,7 @@ func (ctxt *Link) pclntab() {
}
for i := 0; i < len(pcln.Funcdata); i++ {
if pcln.Funcdata[i] == nil {
setuintxx(ctxt, ftab, int64(off)+int64(SysArch.PtrSize)*int64(i), uint64(pcln.Funcdataoff[i]), int64(SysArch.PtrSize))
setuint(ctxt, ftab, int64(off)+int64(SysArch.PtrSize)*int64(i), uint64(pcln.Funcdataoff[i]))
} else {
// TODO: Dedup.
funcdataBytes += pcln.Funcdata[i].Size

View File

@ -318,7 +318,7 @@ func textsectionmap(ctxt *Link) uint32 {
break
}
}
Symgrow(t, nsections*(2*int64(SysArch.PtrSize)+int64(SysArch.PtrSize)))
Symgrow(t, 3*nsections*int64(SysArch.PtrSize))
off := int64(0)
n := 0
@ -337,8 +337,8 @@ func textsectionmap(ctxt *Link) uint32 {
if sect.Name != ".text" {
break
}
off = setuintxx(ctxt, t, off, sect.Vaddr-textbase, int64(SysArch.PtrSize))
off = setuintxx(ctxt, t, off, sect.Length, int64(SysArch.PtrSize))
off = setuint(ctxt, t, off, sect.Vaddr-textbase)
off = setuint(ctxt, t, off, sect.Length)
if n == 0 {
s := ctxt.Syms.ROLookup("runtime.text", 0)
if s == nil {