obj

package
v0.0.0-...-d48c41c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 23, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InvalidOffset          = int(-1)
	InvalidIndex           = uint32(0xFFFFFFFF)
	InlinedCallSize        = int(unsafe.Sizeof(InlinedCall{}))
	EmptyString            = ""
	ABI0Suffix             = ".abi0"
	ABIInternalSuffix      = ".abiinternal"
	UnresolvedSymRefPrefix = "unresolved."
)
View Source
const (
	TypeStringPrefix    = "go:string."
	ObjSymbolSeparator  = ":"
	TypeDoubleDotPrefix = "type:."
	TypePrefix          = "type:"
)
View Source
const (
	IMAGE_SYM_CLASS_STATIC   = 3
	IMAGE_REL_I386_DIR32     = 0x0006
	IMAGE_REL_I386_DIR32NB   = 0x0007
	IMAGE_REL_I386_REL32     = 0x0014
	IMAGE_REL_AMD64_ADDR64   = 0x0001
	IMAGE_REL_AMD64_ADDR32   = 0x0002
	IMAGE_REL_AMD64_ADDR32NB = 0x0003
	IMAGE_REL_AMD64_REL32    = 0x0004
)

See cmd/link/internal/loadpd/ldpe.go for reference

View Source
const (
	EmptyPkgPath = "<unlinkable>"
)

Variables

View Source
var (
	ModuleHeadx86 = []byte{0xF1, 0xFF, 0xFF, 0xFF, 0x0, 0x0, 0x1, 0x0}
	ModuleHeadarm = []byte{0xF1, 0xFF, 0xFF, 0xFF, 0x0, 0x0, 0x4, 0x0}
)

golang 1.20 change magic number

Functions

func ParseUnresolvedIdxString

func ParseUnresolvedIdxString(unresolved string) goobj.SymRef

func UnresolvedIdxString

func UnresolvedIdxString(symRef goobj.SymRef) string

Types

type CompilationUnitFiles

type CompilationUnitFiles struct {
	ArchiveName string
	Files       []string
}

type ExportSymType

type ExportSymType struct {
	SymName  string
	TypeName string
}

type Func

type Func struct {
	PCData   []uint32
	FuncData []uintptr
}

type FuncID

type FuncID uint8
const (
	FuncIDNormal FuncID = iota // not a special function
	FuncID_abort
	FuncID_asmcgocall
	FuncID_asyncPreempt
	FuncID_cgocallback
	FuncID_debugCallV2
	FuncID_gcBgMarkWorker
	FuncID_goexit
	FuncID_gogo
	FuncID_gopanic
	FuncID_handleAsyncEvent
	FuncID_mcall
	FuncID_morestack
	FuncID_mstart
	FuncID_panicwrap
	FuncID_rt0_go
	FuncID_runfinq
	FuncID_runtime_main
	FuncID_sigpanic
	FuncID_systemstack
	FuncID_systemstack_switch
	FuncIDWrapper // any autogenerated code (hash/eq algorithms, method wrappers, etc.)
)

type FuncInfo

type FuncInfo struct {
	Args      uint32
	Locals    uint32
	FuncID    uint8
	FuncFlag  uint8
	StartLine int32
	PCSP      []byte
	PCFile    []byte
	PCLine    []byte
	PCInline  []byte
	PCData    [][]byte
	File      []string
	FuncData  []string
	InlTree   []InlTreeNode
	ABI       uint16
	CUOffset  int
}

type InlTreeNode

type InlTreeNode struct {
	Parent   int64
	File     string
	Line     int64
	Func     string
	ParentPC int64
}

type InlinedCall

type InlinedCall struct {
	// contains filtered or unexported fields
}

inlinedCall is the encoding of entries in the FUNCDATA_InlTree table.

func InitInlinedCall

func InitInlinedCall(inl InlTreeNode, funcid uint8, namemap map[string]int, filetab []uint32) InlinedCall

type ObjSymbol

type ObjSymbol struct {
	Name   string
	Kind   int    // kind of symbol
	DupOK  bool   // are duplicate definitions okay?
	Size   int64  // size of corresponding data
	Data   []byte // memory image of symbol
	Type   string
	Reloc  []Reloc
	Func   *FuncInfo // additional data for functions
	Objidx uint32    // the index of the archive which the symbol came from when loading multiple files
	Pkg    string
}

type Pkg

type Pkg struct {
	Syms           map[string]*ObjSymbol
	CUFiles        []CompilationUnitFiles
	Arch           string
	PkgPath        string
	F              *os.File
	SymNameOrder   []string
	Objidx         uint32 // index of this archive in the slice of files
	ReferencedPkgs []string
	SymNamesByIdx  map[uint32]string
	AutoLib        []string
	Exports        map[string]ExportSymType
}

func (*Pkg) Symbols

func (pkg *Pkg) Symbols() error

type Reloc

type Reloc struct {
	Offset         int
	Sym            *Sym
	Size           int
	Type           int
	Add            int
	EpilogueOffset int // This is added to store the offset of the extra instructions added by goloader in the case of certain overflowing relocations, e.g. ADRP, PCREL, CALLARM64
	EpilogueSize   int
}

copy from $GOROOT/src/cmd/internal/goobj/read.go type Reloc struct

type Sym

type Sym struct {
	Name   string
	Kind   int
	Offset int
	Func   *Func
	Reloc  []Reloc
	Pkg    string
	Size   int
}

copy from $GOROOT/src/cmd/internal/goobj/read.go type Sym struct

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL