Documentation ¶
Index ¶
- Constants
- func BuiltinIdx(name string, abi int) int
- func BuiltinName(i int) (string, int)
- func NBuiltin() int
- type Aux
- type CUFileIndex
- type FingerprintType
- type FuncInfo
- func (*FuncInfo) ReadArgs(b []byte) uint32
- func (*FuncInfo) ReadFile(b []byte, filesoff uint32, k uint32) CUFileIndex
- func (*FuncInfo) ReadFuncFlag(b []byte) objabi.FuncFlag
- func (*FuncInfo) ReadFuncID(b []byte) objabi.FuncID
- func (*FuncInfo) ReadFuncInfoLengths(b []byte) FuncInfoLengths
- func (*FuncInfo) ReadInlTree(b []byte, inltreeoff uint32, k uint32) InlTreeNode
- func (*FuncInfo) ReadLocals(b []byte) uint32
- func (*FuncInfo) ReadStartLine(b []byte) int32
- func (a *FuncInfo) Write(w *bytes.Buffer)
- type FuncInfoLengths
- type Hash64Type
- type HashType
- type Header
- type ImportedPkg
- type InlTreeNode
- type Reader
- func (r *Reader) Autolib() []ImportedPkg
- func (r *Reader) Aux(i uint32, j int) *Aux
- func (r *Reader) AuxOff(i uint32, j int) uint32
- func (r *Reader) Auxs(i uint32) []Aux
- func (r *Reader) BytesAt(off uint32, len int) []byte
- func (r *Reader) Data(i uint32) []byte
- func (r *Reader) DataOff(i uint32) uint32
- func (r *Reader) DataSize(i uint32) int
- func (r *Reader) File(i int) string
- func (r *Reader) Fingerprint() FingerprintType
- func (r *Reader) Flags() uint32
- func (r *Reader) FromAssembly() bool
- func (r *Reader) Hash(i uint32) *HashType
- func (r *Reader) Hash64(i uint32) uint64
- func (r *Reader) NAux(i uint32) int
- func (r *Reader) NFile() int
- func (r *Reader) NHashed64def() int
- func (r *Reader) NHasheddef() int
- func (r *Reader) NNonpkgdef() int
- func (r *Reader) NNonpkgref() int
- func (r *Reader) NPkg() int
- func (r *Reader) NRefFlags() int
- func (r *Reader) NRefName() int
- func (r *Reader) NReloc(i uint32) int
- func (r *Reader) NSym() int
- func (r *Reader) Pkg(i int) string
- func (r *Reader) Pkglist() []string
- func (r *Reader) ReadOnly() bool
- func (r *Reader) RefFlags(i int) *RefFlags
- func (r *Reader) RefName(i int) *RefName
- func (r *Reader) Reloc(i uint32, j int) *Reloc
- func (r *Reader) RelocOff(i uint32, j int) uint32
- func (r *Reader) Relocs(i uint32) []Reloc
- func (r *Reader) Shared() bool
- func (r *Reader) StringAt(off uint32, len uint32) string
- func (r *Reader) StringRef(off uint32) string
- func (r *Reader) Sym(i uint32) *Sym
- func (r *Reader) SymOff(i uint32) uint32
- func (r *Reader) Unlinkable() bool
- type RefFlags
- type RefName
- type Reloc
- func (r *Reloc) Add() int64
- func (r *Reloc) Off() int32
- func (r *Reloc) Set(off int32, size uint8, typ uint16, add int64, sym SymRef)
- func (r *Reloc) SetAdd(x int64)
- func (r *Reloc) SetOff(x int32)
- func (r *Reloc) SetSiz(x uint8)
- func (r *Reloc) SetSym(x SymRef)
- func (r *Reloc) SetType(x uint16)
- func (r *Reloc) Siz() uint8
- func (r *Reloc) Sym() SymRef
- func (r *Reloc) Type() uint16
- func (r *Reloc) Write(w *Writer)
- type Sym
- func (s *Sym) ABI() uint16
- func (s *Sym) Align() uint32
- func (s *Sym) Dupok() bool
- func (s *Sym) Flag() uint8
- func (s *Sym) Flag2() uint8
- func (s *Sym) IsDict() bool
- func (s *Sym) IsGoType() bool
- func (s *Sym) IsItab() bool
- func (s *Sym) Leaf() bool
- func (s *Sym) Local() bool
- func (s *Sym) Name(r *Reader) string
- func (s *Sym) NameLen(r *Reader) int
- func (s *Sym) NoSplit() bool
- func (s *Sym) ReflectMethod() bool
- func (s *Sym) SetABI(x uint16)
- func (s *Sym) SetAlign(x uint32)
- func (s *Sym) SetFlag(x uint8)
- func (s *Sym) SetFlag2(x uint8)
- func (s *Sym) SetName(x string, w *Writer)
- func (s *Sym) SetSiz(x uint32)
- func (s *Sym) SetType(x uint8)
- func (s *Sym) Siz() uint32
- func (s *Sym) Type() uint8
- func (s *Sym) Typelink() bool
- func (s *Sym) UsedInIface() bool
- func (s *Sym) Write(w *Writer)
- type SymRef
- type Writer
- func (w *Writer) AddString(s string)
- func (w *Writer) Bytes(s []byte)
- func (w *Writer) Offset() uint32
- func (w *Writer) RawString(s string)
- func (w *Writer) StringRef(s string)
- func (w *Writer) Uint16(x uint16)
- func (w *Writer) Uint32(x uint32)
- func (w *Writer) Uint64(x uint64)
- func (w *Writer) Uint8(x uint8)
Constants ¶
const ( PkgIdxNone = (1<<31 - 1) - iota // Non-package symbols PkgIdxHashed64 // Short hashed (content-addressable) symbols PkgIdxHashed // Hashed (content-addressable) symbols PkgIdxBuiltin // Predefined runtime symbols (ex: runtime.newobject) PkgIdxSelf // Symbols defined in the current package PkgIdxSpecial = PkgIdxSelf // Indices above it has special meanings PkgIdxInvalid = 0 )
Package Index.
const ( BlkAutolib = iota BlkPkgIdx BlkFile BlkSymdef BlkHashed64def BlkHasheddef BlkNonpkgdef BlkNonpkgref BlkRefFlags BlkHash64 BlkHash BlkRelocIdx BlkAuxIdx BlkDataIdx BlkReloc BlkAux BlkData BlkRefName BlkEnd NBlk )
Blocks
const ( ObjFlagFromAssembly // object is from asm src, not go ObjFlagUnlinkable // unlinkable package (linker will emit an error) )
const ( SymFlagDupok = 1 << iota SymFlagLocal SymFlagTypelink SymFlagLeaf SymFlagNoSplit SymFlagReflectMethod SymFlagGoType )
Sym.Flag
const ( SymFlagUsedInIface = 1 << iota SymFlagItab SymFlagDict )
Sym.Flag2
const ( AuxGotype = iota AuxFuncInfo AuxFuncdata AuxDwarfInfo AuxDwarfLoc AuxDwarfRanges AuxDwarfLines AuxPcsp AuxPcfile AuxPcline AuxPcinline AuxPcdata )
Aux Type
const AuxSize = 1 + 8
const Hash64Size = 8
const HashSize = 16 // truncated SHA256
const Magic = "\x00go120ld"
const RefFlagsSize = 8 + 1 + 1
const RefNameSize = 8 + stringRefSize
const RelocSize = 4 + 1 + 2 + 8 + 8
const SymABIstatic = ^uint16(0)
const SymSize = stringRefSize + 2 + 1 + 1 + 1 + 4 + 4
Variables ¶
This section is empty.
Functions ¶
func BuiltinIdx ¶ added in go1.16
BuiltinIdx returns the index of the builtin with the given name and abi, or -1 if it is not a builtin.
func BuiltinName ¶ added in go1.16
BuiltinName returns the name and ABI of the i-th builtin symbol.
Types ¶
type CUFileIndex ¶ added in go1.16
type CUFileIndex uint32
CUFileIndex is used to index the filenames that are stored in the per-package/per-CU FileList.
type FingerprintType ¶ added in go1.16
type FingerprintType [8]byte
func (FingerprintType) IsZero ¶ added in go1.16
func (fp FingerprintType) IsZero() bool
type FuncInfo ¶ added in go1.16
type FuncInfo struct { Args uint32 Locals uint32 FuncID objabi.FuncID FuncFlag objabi.FuncFlag StartLine int32 File []CUFileIndex InlTree []InlTreeNode }
FuncInfo is serialized as a symbol (aux symbol). The symbol data is the binary encoding of the struct below.
func (*FuncInfo) ReadFile ¶ added in go1.16
func (*FuncInfo) ReadFile(b []byte, filesoff uint32, k uint32) CUFileIndex
func (*FuncInfo) ReadFuncFlag ¶ added in go1.17
func (*FuncInfo) ReadFuncInfoLengths ¶ added in go1.16
func (*FuncInfo) ReadFuncInfoLengths(b []byte) FuncInfoLengths
func (*FuncInfo) ReadInlTree ¶ added in go1.16
func (*FuncInfo) ReadInlTree(b []byte, inltreeoff uint32, k uint32) InlTreeNode
func (*FuncInfo) ReadLocals ¶ added in go1.16
func (*FuncInfo) ReadStartLine ¶ added in go1.20
type FuncInfoLengths ¶ added in go1.16
type FuncInfoLengths struct { NumFile uint32 FileOff uint32 NumInlTree uint32 InlTreeOff uint32 Initialized bool }
FuncInfoLengths is a cache containing a roadmap of offsets and lengths for things within a serialized FuncInfo. Each length field stores the number of items (e.g. files, inltree nodes, etc), and the corresponding "off" field stores the byte offset of the start of the items in question.
type Header ¶ added in go1.16
type Header struct { Magic string Fingerprint FingerprintType Flags uint32 Offsets [NBlk]uint32 }
File header. TODO: probably no need to export this.
type ImportedPkg ¶ added in go1.16
type ImportedPkg struct { Pkg string Fingerprint FingerprintType }
Autolib
func (*ImportedPkg) Write ¶ added in go1.16
func (p *ImportedPkg) Write(w *Writer)
type InlTreeNode ¶ added in go1.16
type InlTreeNode struct { Parent int32 File CUFileIndex Line int32 Func SymRef ParentPC int32 }
InlTreeNode is the serialized form of FileInfo.InlTree.
func (*InlTreeNode) Read ¶ added in go1.16
func (inl *InlTreeNode) Read(b []byte) []byte
Read an InlTreeNode from b, return the remaining bytes.
func (*InlTreeNode) Write ¶ added in go1.16
func (inl *InlTreeNode) Write(w *bytes.Buffer)
type Reader ¶ added in go1.16
type Reader struct {
// contains filtered or unexported fields
}
func NewReaderFromBytes ¶ added in go1.16
func (*Reader) Autolib ¶ added in go1.16
func (r *Reader) Autolib() []ImportedPkg
func (*Reader) Aux ¶ added in go1.16
Aux returns a pointer to the j-th aux symbol of the i-th symbol.
func (*Reader) AuxOff ¶ added in go1.16
AuxOff returns the offset of the j-th aux symbol of the i-th symbol.
func (*Reader) Fingerprint ¶ added in go1.16
func (r *Reader) Fingerprint() FingerprintType
func (*Reader) Flags ¶ added in go1.16
Flags returns the flag bits read from the object file header.
func (*Reader) FromAssembly ¶ added in go1.16
func (*Reader) Hash ¶ added in go1.16
Hash returns a pointer to the i-th hashed symbol's hash. Note: here i is the index of hashed symbols, not all symbols (unlike other accessors).
func (*Reader) Hash64 ¶ added in go1.16
Hash64 returns the i-th short hashed symbol's hash. Note: here i is the index of short hashed symbols, not all symbols (unlike other accessors).
func (*Reader) NHashed64def ¶ added in go1.16
func (*Reader) NHasheddef ¶ added in go1.16
func (*Reader) NNonpkgdef ¶ added in go1.16
func (*Reader) NNonpkgref ¶ added in go1.16
func (*Reader) NReloc ¶ added in go1.16
NReloc returns the number of relocations of the i-th symbol.
func (*Reader) ReadOnly ¶ added in go1.16
ReadOnly returns whether r.BytesAt returns read-only bytes.
func (*Reader) RefFlags ¶ added in go1.16
RefFlags returns a pointer to the i-th referenced symbol flags. Note: here i is not a local symbol index, just a counter.
func (*Reader) RefName ¶ added in go1.16
RefName returns a pointer to the i-th referenced symbol name. Note: here i is not a local symbol index, just a counter.
func (*Reader) Reloc ¶ added in go1.16
Reloc returns a pointer to the j-th relocation of the i-th symbol.
func (*Reader) RelocOff ¶ added in go1.16
RelocOff returns the offset of the j-th relocation of the i-th symbol.
func (*Reader) Relocs ¶ added in go1.16
Relocs returns a pointer to the relocations of the i-th symbol.
func (*Reader) Unlinkable ¶ added in go1.19
type RefFlags ¶ added in go1.16
type RefFlags [RefFlagsSize]byte
Referenced symbol flags.
Serialized format:
RefFlags struct { Sym symRef Flag uint8 Flag2 uint8 }
type RefName ¶ added in go1.16
type RefName [RefNameSize]byte
Referenced symbol name.
Serialized format:
RefName struct { Sym symRef Name string }
type Reloc ¶
Relocation.
Serialized format:
Reloc struct { Off int32 Siz uint8 Type uint16 Add int64 Sym SymRef }
type Sym ¶
Symbol definition.
Serialized format:
Sym struct { Name string ABI uint16 Type uint8 Flag uint8 Flag2 uint8 Siz uint32 Align uint32 }