mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/internal/objabi: extract shared functionality from obj
Now only cmd/asm and cmd/compile depend on cmd/internal/obj. Changing the assembler backends no longer requires reinstalling cmd/link or cmd/addr2line. There's also now one canonical definition of the object file format in cmd/internal/objabi/doc.go, with a warning to update all three implementations. objabi is still something of a grab bag of unrelated code (e.g., flag and environment variable handling probably belong in a separate "tool" package), but this is still progress. Fixes #15165. Fixes #20026. Change-Id: Ic4b92fac7d0d35438e0d20c9579aad4085c5534c Reviewed-on: https://go-review.googlesource.com/40972 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
This commit is contained in:
parent
f71f32e5e1
commit
1e3570ac86
118 changed files with 2419 additions and 2407 deletions
|
|
@ -8,6 +8,7 @@ import (
|
|||
"cmd/compile/internal/types"
|
||||
"cmd/internal/gcprog"
|
||||
"cmd/internal/obj"
|
||||
"cmd/internal/objabi"
|
||||
"cmd/internal/src"
|
||||
"fmt"
|
||||
"os"
|
||||
|
|
@ -677,38 +678,38 @@ func dmethodptrOffLSym(s *obj.LSym, ot int, x *obj.LSym) int {
|
|||
r.Off = int32(ot)
|
||||
r.Siz = 4
|
||||
r.Sym = x
|
||||
r.Type = obj.R_METHODOFF
|
||||
r.Type = objabi.R_METHODOFF
|
||||
return ot + 4
|
||||
}
|
||||
|
||||
var kinds = []int{
|
||||
TINT: obj.KindInt,
|
||||
TUINT: obj.KindUint,
|
||||
TINT8: obj.KindInt8,
|
||||
TUINT8: obj.KindUint8,
|
||||
TINT16: obj.KindInt16,
|
||||
TUINT16: obj.KindUint16,
|
||||
TINT32: obj.KindInt32,
|
||||
TUINT32: obj.KindUint32,
|
||||
TINT64: obj.KindInt64,
|
||||
TUINT64: obj.KindUint64,
|
||||
TUINTPTR: obj.KindUintptr,
|
||||
TFLOAT32: obj.KindFloat32,
|
||||
TFLOAT64: obj.KindFloat64,
|
||||
TBOOL: obj.KindBool,
|
||||
TSTRING: obj.KindString,
|
||||
TPTR32: obj.KindPtr,
|
||||
TPTR64: obj.KindPtr,
|
||||
TSTRUCT: obj.KindStruct,
|
||||
TINTER: obj.KindInterface,
|
||||
TCHAN: obj.KindChan,
|
||||
TMAP: obj.KindMap,
|
||||
TARRAY: obj.KindArray,
|
||||
TSLICE: obj.KindSlice,
|
||||
TFUNC: obj.KindFunc,
|
||||
TCOMPLEX64: obj.KindComplex64,
|
||||
TCOMPLEX128: obj.KindComplex128,
|
||||
TUNSAFEPTR: obj.KindUnsafePointer,
|
||||
TINT: objabi.KindInt,
|
||||
TUINT: objabi.KindUint,
|
||||
TINT8: objabi.KindInt8,
|
||||
TUINT8: objabi.KindUint8,
|
||||
TINT16: objabi.KindInt16,
|
||||
TUINT16: objabi.KindUint16,
|
||||
TINT32: objabi.KindInt32,
|
||||
TUINT32: objabi.KindUint32,
|
||||
TINT64: objabi.KindInt64,
|
||||
TUINT64: objabi.KindUint64,
|
||||
TUINTPTR: objabi.KindUintptr,
|
||||
TFLOAT32: objabi.KindFloat32,
|
||||
TFLOAT64: objabi.KindFloat64,
|
||||
TBOOL: objabi.KindBool,
|
||||
TSTRING: objabi.KindString,
|
||||
TPTR32: objabi.KindPtr,
|
||||
TPTR64: objabi.KindPtr,
|
||||
TSTRUCT: objabi.KindStruct,
|
||||
TINTER: objabi.KindInterface,
|
||||
TCHAN: objabi.KindChan,
|
||||
TMAP: objabi.KindMap,
|
||||
TARRAY: objabi.KindArray,
|
||||
TSLICE: objabi.KindSlice,
|
||||
TFUNC: objabi.KindFunc,
|
||||
TCOMPLEX64: objabi.KindComplex64,
|
||||
TCOMPLEX128: objabi.KindComplex128,
|
||||
TUNSAFEPTR: objabi.KindUnsafePointer,
|
||||
}
|
||||
|
||||
// typeptrdata returns the length in bytes of the prefix of t
|
||||
|
|
@ -867,13 +868,13 @@ func dcommontype(s *types.Sym, ot int, t *types.Type) int {
|
|||
|
||||
i = kinds[t.Etype]
|
||||
if !types.Haspointers(t) {
|
||||
i |= obj.KindNoPointers
|
||||
i |= objabi.KindNoPointers
|
||||
}
|
||||
if isdirectiface(t) {
|
||||
i |= obj.KindDirectIface
|
||||
i |= objabi.KindDirectIface
|
||||
}
|
||||
if useGCProg {
|
||||
i |= obj.KindGCProg
|
||||
i |= objabi.KindGCProg
|
||||
}
|
||||
ot = duint8(s, ot, uint8(i)) // kind
|
||||
if algsym == nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue