diff options
Diffstat (limited to 'libgo/go/debug/plan9obj/plan9obj.go')
-rw-r--r-- | libgo/go/debug/plan9obj/plan9obj.go | 63 |
1 files changed, 4 insertions, 59 deletions
diff --git a/libgo/go/debug/plan9obj/plan9obj.go b/libgo/go/debug/plan9obj/plan9obj.go index 4e3b08f4164..af9858562f9 100644 --- a/libgo/go/debug/plan9obj/plan9obj.go +++ b/libgo/go/debug/plan9obj/plan9obj.go @@ -8,11 +8,6 @@ package plan9obj -import ( - "bytes" - "encoding/binary" -) - // Plan 9 Program header. type prog struct { Magic uint32 /* magic number */ @@ -33,59 +28,9 @@ type sym struct { } const ( - hsize = 4 * 8 - _HDR_MAGIC = 0x00008000 /* header expansion */ -) - -func magic(f, b int) string { - buf := new(bytes.Buffer) - var i uint32 = uint32((f) | ((((4 * (b)) + 0) * (b)) + 7)) - binary.Write(buf, binary.BigEndian, i) - return string(buf.Bytes()) -} + Magic64 = 0x8000 // 64-bit expanded header -var ( - _A_MAGIC = magic(0, 8) /* 68020 (retired) */ - _I_MAGIC = magic(0, 11) /* intel 386 */ - _J_MAGIC = magic(0, 12) /* intel 960 (retired) */ - _K_MAGIC = magic(0, 13) /* sparc */ - _V_MAGIC = magic(0, 16) /* mips 3000 BE */ - _X_MAGIC = magic(0, 17) /* att dsp 3210 (retired) */ - _M_MAGIC = magic(0, 18) /* mips 4000 BE */ - _D_MAGIC = magic(0, 19) /* amd 29000 (retired) */ - _E_MAGIC = magic(0, 20) /* arm */ - _Q_MAGIC = magic(0, 21) /* powerpc */ - _N_MAGIC = magic(0, 22) /* mips 4000 LE */ - _L_MAGIC = magic(0, 23) /* dec alpha (retired) */ - _P_MAGIC = magic(0, 24) /* mips 3000 LE */ - _U_MAGIC = magic(0, 25) /* sparc64 (retired) */ - _S_MAGIC = magic(_HDR_MAGIC, 26) /* amd64 */ - _T_MAGIC = magic(_HDR_MAGIC, 27) /* powerpc64 */ - _R_MAGIC = magic(_HDR_MAGIC, 28) /* arm64 */ + Magic386 = (4*11+0)*11 + 7 + MagicAMD64 = (4*26+0)*26 + 7 + Magic64 + MagicARM = (4*20+0)*20 + 7 ) - -type ExecTable struct { - Magic string - Ptrsz int - Hsize uint32 -} - -var exectab = []ExecTable{ - {_A_MAGIC, 4, hsize}, - {_I_MAGIC, 4, hsize}, - {_J_MAGIC, 4, hsize}, - {_K_MAGIC, 4, hsize}, - {_V_MAGIC, 4, hsize}, - {_X_MAGIC, 4, hsize}, - {_M_MAGIC, 4, hsize}, - {_D_MAGIC, 4, hsize}, - {_E_MAGIC, 4, hsize}, - {_Q_MAGIC, 4, hsize}, - {_N_MAGIC, 4, hsize}, - {_L_MAGIC, 4, hsize}, - {_P_MAGIC, 4, hsize}, - {_U_MAGIC, 4, hsize}, - {_S_MAGIC, 8, hsize + 8}, - {_T_MAGIC, 8, hsize + 8}, - {_R_MAGIC, 8, hsize + 8}, -} |