mirror of
https://github.com/golang/go.git
synced 2025-05-31 23:25:39 +00:00
cmd/link: use symbolic offset for ITab.Type
Change-Id: If04c24d5209cd241e300ce714efdd0e0dde61af2 Reviewed-on: https://go-review.googlesource.com/c/go/+/549456 Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Than McIntosh <thanm@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
977803e796
commit
109c7bbf8f
@ -85,6 +85,9 @@ func Init() {
|
||||
if got, want := int64(abi.TFlagOff(ptrSize)), Type.OffsetOf("TFlag"); got != want {
|
||||
base.Fatalf("abi.TFlagOff() == %d, want %d", got, want)
|
||||
}
|
||||
if got, want := int64(abi.ITabTypeOff(ptrSize)), ITab.OffsetOf("Type"); got != want {
|
||||
base.Fatalf("abi.ITabTypeOff() == %d, want %d", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
// fromReflect translates from a host type to the equivalent target type.
|
||||
|
@ -304,5 +304,5 @@ func decodetypeGcprogShlib(ctxt *Link, data []byte) uint64 {
|
||||
// decodeItabType returns the itab.Type field from an itab.
|
||||
func decodeItabType(ldr *loader.Loader, arch *sys.Arch, symIdx loader.Sym) loader.Sym {
|
||||
relocs := ldr.Relocs(symIdx)
|
||||
return decodeRelocSym(ldr, symIdx, &relocs, int32(arch.PtrSize))
|
||||
return decodeRelocSym(ldr, symIdx, &relocs, int32(abi.ITabTypeOff(arch.PtrSize)))
|
||||
}
|
||||
|
@ -23,3 +23,6 @@ func UncommonSize() uint64 { return 4 + 2 + 2 + 4 + 4 }
|
||||
|
||||
// TFlagOff returns the offset of Type.TFlag for a compilation target with a given ptrSize
|
||||
func TFlagOff(ptrSize int) int { return 2*ptrSize + 4 }
|
||||
|
||||
// ITabTypeOff returns the offset of ITab.Type for a compilation target with a given ptrSize
|
||||
func ITabTypeOff(ptrSize int) int { return ptrSize }
|
||||
|
Loading…
x
Reference in New Issue
Block a user