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:
parent
2a18cc10b1
commit
06e5749f01
@ -140,6 +140,10 @@ func setuint32(ctxt *Link, s *Symbol, r int64, v uint32) int64 {
|
|||||||
return setuintxx(ctxt, s, r, uint64(v), 4)
|
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 {
|
func Addaddrplus(ctxt *Link, s *Symbol, t *Symbol, add int64) int64 {
|
||||||
if s.Type == 0 {
|
if s.Type == 0 {
|
||||||
s.Type = objabi.SDATA
|
s.Type = objabi.SDATA
|
||||||
|
@ -214,7 +214,7 @@ func decodetypeStructFieldCount(arch *sys.Arch, s *Symbol) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func decodetypeStructFieldArrayOff(s *Symbol, i int) int {
|
func decodetypeStructFieldArrayOff(s *Symbol, i int) int {
|
||||||
off := commonsize() + 2*SysArch.PtrSize + 2*SysArch.PtrSize
|
off := commonsize() + 4*SysArch.PtrSize
|
||||||
if decodetypeHasUncommon(s) {
|
if decodetypeHasUncommon(s) {
|
||||||
off += uncommonSize()
|
off += uncommonSize()
|
||||||
}
|
}
|
||||||
@ -342,7 +342,7 @@ func decodetypeMethods(arch *sys.Arch, s *Symbol) []methodsig {
|
|||||||
off := commonsize() // reflect.rtype
|
off := commonsize() // reflect.rtype
|
||||||
switch decodetypeKind(s) & kindMask {
|
switch decodetypeKind(s) & kindMask {
|
||||||
case kindStruct: // reflect.structType
|
case kindStruct: // reflect.structType
|
||||||
off += 2*SysArch.PtrSize + 2*SysArch.PtrSize
|
off += 4 * SysArch.PtrSize
|
||||||
case kindPtr: // reflect.ptrType
|
case kindPtr: // reflect.ptrType
|
||||||
off += SysArch.PtrSize
|
off += SysArch.PtrSize
|
||||||
case kindFunc: // reflect.funcType
|
case kindFunc: // reflect.funcType
|
||||||
@ -356,7 +356,7 @@ func decodetypeMethods(arch *sys.Arch, s *Symbol) []methodsig {
|
|||||||
case kindMap: // reflect.mapType
|
case kindMap: // reflect.mapType
|
||||||
off += 4*SysArch.PtrSize + 8
|
off += 4*SysArch.PtrSize + 8
|
||||||
case kindInterface: // reflect.interfaceType
|
case kindInterface: // reflect.interfaceType
|
||||||
off += SysArch.PtrSize + 2*SysArch.PtrSize
|
off += 3 * SysArch.PtrSize
|
||||||
default:
|
default:
|
||||||
// just Sizeof(rtype)
|
// just Sizeof(rtype)
|
||||||
}
|
}
|
||||||
|
@ -230,7 +230,7 @@ func (ctxt *Link) pclntab() {
|
|||||||
setuint32(ctxt, ftab, 0, 0xfffffffb)
|
setuint32(ctxt, ftab, 0, 0xfffffffb)
|
||||||
setuint8(ctxt, ftab, 6, uint8(SysArch.MinLC))
|
setuint8(ctxt, ftab, 6, uint8(SysArch.MinLC))
|
||||||
setuint8(ctxt, ftab, 7, uint8(SysArch.PtrSize))
|
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)
|
pclntabPclntabOffset = int32(8 + SysArch.PtrSize)
|
||||||
|
|
||||||
funcnameoff := make(map[string]int32)
|
funcnameoff := make(map[string]int32)
|
||||||
@ -282,7 +282,7 @@ func (ctxt *Link) pclntab() {
|
|||||||
funcstart += int32(-len(ftab.P)) & (int32(SysArch.PtrSize) - 1)
|
funcstart += int32(-len(ftab.P)) & (int32(SysArch.PtrSize) - 1)
|
||||||
|
|
||||||
setaddr(ctxt, ftab, 8+int64(SysArch.PtrSize)+int64(nfunc)*2*int64(SysArch.PtrSize), s)
|
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
|
// Write runtime._func. Keep in sync with ../../../../runtime/runtime2.go:/_func
|
||||||
// and package debug/gosym.
|
// and package debug/gosym.
|
||||||
@ -375,7 +375,7 @@ func (ctxt *Link) pclntab() {
|
|||||||
}
|
}
|
||||||
for i := 0; i < len(pcln.Funcdata); i++ {
|
for i := 0; i < len(pcln.Funcdata); i++ {
|
||||||
if pcln.Funcdata[i] == nil {
|
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 {
|
} else {
|
||||||
// TODO: Dedup.
|
// TODO: Dedup.
|
||||||
funcdataBytes += pcln.Funcdata[i].Size
|
funcdataBytes += pcln.Funcdata[i].Size
|
||||||
|
@ -318,7 +318,7 @@ func textsectionmap(ctxt *Link) uint32 {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Symgrow(t, nsections*(2*int64(SysArch.PtrSize)+int64(SysArch.PtrSize)))
|
Symgrow(t, 3*nsections*int64(SysArch.PtrSize))
|
||||||
|
|
||||||
off := int64(0)
|
off := int64(0)
|
||||||
n := 0
|
n := 0
|
||||||
@ -337,8 +337,8 @@ func textsectionmap(ctxt *Link) uint32 {
|
|||||||
if sect.Name != ".text" {
|
if sect.Name != ".text" {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
off = setuintxx(ctxt, t, off, sect.Vaddr-textbase, int64(SysArch.PtrSize))
|
off = setuint(ctxt, t, off, sect.Vaddr-textbase)
|
||||||
off = setuintxx(ctxt, t, off, sect.Length, int64(SysArch.PtrSize))
|
off = setuint(ctxt, t, off, sect.Length)
|
||||||
if n == 0 {
|
if n == 0 {
|
||||||
s := ctxt.Syms.ROLookup("runtime.text", 0)
|
s := ctxt.Syms.ROLookup("runtime.text", 0)
|
||||||
if s == nil {
|
if s == nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user