Documentation
¶
Index ¶
- Constants
- Variables
- func Bool2int(b bool) int
- func CConv(s uint8) string
- func CConvARM(s uint8) string
- func Dconv(p *Prog, a *Addr) string
- func Flushplist(ctxt *Link, plist *Plist, newprog ProgAlloc, myimportpath string)
- func Mconv(a *Addr) string
- func Nopout(p *Prog)
- func RLconv(list int64) string
- func Rconv(reg int) string
- func RegisterOpSuffix(arch string, cconv func(uint8) string)
- func RegisterOpcode(lo As, Anames []string)
- func RegisterRegister(lo, hi int, Rconv func(int) string)
- func RegisterRegisterList(lo, hi int64, rlconv func(int64) string)
- func SortSlice(slice interface{}, less func(i, j int) bool)
- func WriteObjFile(ctxt *Link, b *bufio.Writer)
- type Addr
- type AddrName
- type AddrType
- type As
- type Attribute
- func (a Attribute) CFunc() bool
- func (a Attribute) DuplicateOK() bool
- func (a Attribute) Leaf() bool
- func (a Attribute) Local() bool
- func (a Attribute) MakeTypelink() bool
- func (a Attribute) NeedCtxt() bool
- func (a Attribute) NoFrame() bool
- func (a Attribute) NoSplit() bool
- func (a Attribute) OnList() bool
- func (a Attribute) ReflectMethod() bool
- func (a Attribute) SeenGlobl() bool
- func (a *Attribute) Set(flag Attribute, value bool)
- func (a Attribute) Static() bool
- func (a Attribute) TextAttrString() string
- func (a Attribute) WasInlined() bool
- func (a Attribute) Wrapper() bool
- type Auto
- type DwarfFixupTable
- func (ft *DwarfFixupTable) AbsFuncDwarfSym(fnsym *LSym) *LSym
- func (ft *DwarfFixupTable) Finalize(myimportpath string, trace bool)
- func (ft *DwarfFixupTable) GetPrecursorFunc(s *LSym) interface{}
- func (ft *DwarfFixupTable) ReferenceChildDIE(s *LSym, ridx int, tgt *LSym, dclidx int, inlIndex int)
- func (ft *DwarfFixupTable) RegisterChildDIEOffsets(s *LSym, vars []*dwarf.Var, coffsets []int32)
- func (ft *DwarfFixupTable) SetPrecursorFunc(s *LSym, fn interface{})
- type FuncInfo
- type InlTree
- type InlinedCall
- type LSym
- func (s *LSym) Grow(lsiz int64)
- func (s *LSym) GrowCap(c int64)
- func (s *LSym) Len() int64
- func (s *LSym) String() string
- func (s *LSym) WriteAddr(ctxt *Link, off int64, siz int, rsym *LSym, roff int64)
- func (s *LSym) WriteBytes(ctxt *Link, off int64, b []byte) int64
- func (s *LSym) WriteFloat32(ctxt *Link, off int64, f float32)
- func (s *LSym) WriteFloat64(ctxt *Link, off int64, f float64)
- func (s *LSym) WriteInt(ctxt *Link, off int64, siz int, i int64)
- func (s *LSym) WriteOff(ctxt *Link, off int64, rsym *LSym, roff int64)
- func (s *LSym) WriteString(ctxt *Link, off int64, siz int, str string)
- func (s *LSym) WriteWeakOff(ctxt *Link, off int64, rsym *LSym, roff int64)
- type Link
- func (ctxt *Link) AddImport(pkg string)
- func (ctxt *Link) CanReuseProgs() bool
- func (ctxt *Link) Diag(format string, args ...interface{})
- func (ctxt *Link) DwarfAbstractFunc(curfn interface{}, s *LSym, myimportpath string)
- func (ctxt *Link) DwarfIntConst(myimportpath, name, typename string, val int64)
- func (ctxt *Link) EmitEntryLiveness(s *LSym, p *Prog, newprog ProgAlloc) *Prog
- func (ctxt *Link) FixedFrameSize() int64
- func (ctxt *Link) Float32Sym(f float32) *LSym
- func (ctxt *Link) Float64Sym(f float64) *LSym
- func (ctxt *Link) Globl(s *LSym, size int64, flag int)
- func (ctxt *Link) InitTextSym(s *LSym, flag int)
- func (ctxt *Link) InnermostPos(xpos src.XPos) src.Pos
- func (ctxt *Link) Int64Sym(i int64) *LSym
- func (ctxt *Link) Logf(format string, args ...interface{})
- func (ctxt *Link) Lookup(name string) *LSym
- func (ctxt *Link) LookupDerived(s *LSym, name string) *LSym
- func (ctxt *Link) LookupInit(name string, init func(s *LSym)) *LSym
- func (ctxt *Link) LookupStatic(name string) *LSym
- func (ctxt *Link) NewProg() *Prog
- func (ctxt *Link) OutermostPos(xpos src.XPos) src.Pos
- type LinkArch
- type Pcdata
- type Pcln
- type Plist
- type Prog
- func (p *Prog) From3Type() AddrTypedeprecated
- func (p *Prog) GetFrom3() *Addrdeprecated
- func (p *Prog) InnermostFilename() string
- func (p *Prog) InnermostLineNumber() string
- func (p *Prog) InnermostLineNumberHTML() string
- func (p *Prog) InstructionString() string
- func (p *Prog) Line() string
- func (p *Prog) SetFrom3(a Addr)deprecated
- func (p *Prog) String() string
- type ProgAlloc
- type Reloc
Constants ¶
const ( ABase386 = (1 + iota) << 11 ABaseARM ABaseAMD64 ABasePPC64 ABaseARM64 ABaseMIPS ABaseS390X ABaseWasm AllowedOpCodes = 1 << 11 // The number of opcodes available for any given architecture. AMask = AllowedOpCodes - 1 // AND with this to use the opcode as an array index. )
Each architecture is allotted a distinct subspace of opcode values for declaring its arch-specific opcodes. Within this subspace, the first arch-specific opcode should be at offset A_ARCHSPECIFIC.
Subspaces are aligned to a power of two so opcodes can be masked with AMask and used as compact array indices.
const ( PrologueEnd = 2 + iota // overload "is_stmt" to include prologue_end EpilogueBegin // overload "is_stmt" to include epilogue_end )
const ( // Don't profile the marked routine. // // Deprecated: Not implemented, do not use. NOPROF = 1 // It is ok for the linker to get multiple of these symbols. It will // pick one of the duplicates to use. DUPOK = 2 // Don't insert stack check preamble. NOSPLIT = 4 // Put this data in a read-only section. RODATA = 8 // This data contains no pointers. NOPTR = 16 // This is a wrapper function and should not count as disabling 'recover'. WRAPPER = 32 // This function uses its incoming context register. NEEDCTXT = 64 // When passed to ggloblsym, causes Local to be set to true on the LSym it creates. LOCAL = 128 // Allocate a word of thread local storage and store the offset from the // thread local base to the thread local storage in this variable. TLSBSS = 256 // Do not insert instructions to allocate a stack frame for this function. // Only valid on functions that declare a frame size of 0. // TODO(mwhudson): only implemented for ppc64x at present. NOFRAME = 512 // Function can call reflect.Type.Method or reflect.Type.MethodByName. REFLECTMETHOD = 1024 )
const ( C_SCOND = (1 << 4) - 1 C_SBIT = 1 << 4 C_PBIT = 1 << 5 C_WBIT = 1 << 6 C_FBIT = 1 << 7 C_UBIT = 1 << 7 C_SCOND_XOR = 14 )
ARM scond byte
const ( // Because of masking operations in the encodings, each register // space should start at 0 modulo some power of 2. RBase386 = 1 * 1024 RBaseAMD64 = 2 * 1024 RBaseARM = 3 * 1024 RBasePPC64 = 4 * 1024 // range [4k, 8k) RBaseARM64 = 8 * 1024 // range [8k, 13k) RBaseMIPS = 13 * 1024 // range [13k, 14k) RBaseS390X = 14 * 1024 // range [14k, 15k) RBaseWasm = 16 * 1024 )
const ( RegListARMLo = 0 RegListARMHi = 1 << 16 // arm64 uses the 60th bit to differentiate from other archs RegListARM64Lo = 1 << 60 RegListARM64Hi = 1<<61 - 1 // x86 uses the 61th bit to differentiate from other archs RegListX86Lo = 1 << 61 RegListX86Hi = 1<<62 - 1 )
Each architecture is allotted a distinct subspace: [Lo, Hi) for declaring its arch-specific register list numbers.
const (
LOG = 5
)
const REG_NONE = 0
Variables ¶
var Anames = []string{
"XXX",
"CALL",
"DUFFCOPY",
"DUFFZERO",
"END",
"FUNCDATA",
"JMP",
"NOP",
"PCDATA",
"RET",
"GETCALLERPC",
"TEXT",
"UNDEF",
}
Functions ¶
func RegisterOpSuffix ¶
RegisterOpSuffix assigns cconv function for formatting opcode suffixes when compiling for GOARCH=arch.
cconv is never called with 0 argument.
func RegisterOpcode ¶
RegisterOpcode binds a list of instruction names to a given instruction number range.
func RegisterRegister ¶
RegisterRegister binds a pretty-printer (Rconv) for register numbers to a given register number range. Lo is inclusive, hi exclusive (valid registers are lo through hi-1).
func RegisterRegisterList ¶
RegisterRegisterList binds a pretty-printer (RLconv) for register list numbers to a given register list number range. Lo is inclusive, hi exclusive (valid register list are lo through hi-1).
func WriteObjFile ¶
Types ¶
type Addr ¶
type Addr struct {
Reg int16
Index int16
Scale int16 // Sometimes holds a register.
Type AddrType
Name AddrName
Class int8
Offset int64
Sym *LSym
// argument value:
// for TYPE_SCONST, a string
// for TYPE_FCONST, a float64
// for TYPE_BRANCH, a *Prog (optional)
// for TYPE_TEXTSIZE, an int32 (optional)
Val interface{}
}
type AddrName ¶
type AddrName int8
const ( NAME_NONE AddrName = iota NAME_EXTERN NAME_STATIC NAME_AUTO NAME_PARAM // A reference to name@GOT(SB) is a reference to the entry in the global offset // table for 'name'. NAME_GOTREF // Indicates auto that was optimized away, but whose type // we want to preserve in the DWARF debug info. NAME_DELETED_AUTO )
type As ¶
type As int16
An As denotes an assembler opcode. There are some portable opcodes, declared here in package obj, that are common to all architectures. However, the majority of opcodes are arch-specific and are declared in their respective architecture's subpackage.
type Attribute ¶
type Attribute int16
Attribute is a set of symbol attributes.
const ( AttrDuplicateOK Attribute = 1 << iota AttrCFunc AttrNoSplit AttrLeaf AttrWrapper AttrNeedCtxt AttrNoFrame AttrSeenGlobl AttrOnList AttrStatic // MakeTypelink means that the type should have an entry in the typelink table. AttrMakeTypelink // ReflectMethod means the function may call reflect.Type.Method or // reflect.Type.MethodByName. Matching is imprecise (as reflect.Type // can be used through a custom interface), so ReflectMethod may be // set in some cases when the reflect package is not called. // // Used by the linker to determine what methods can be pruned. AttrReflectMethod // Local means make the symbol local even when compiling Go code to reference Go // symbols in other shared libraries, as in this mode symbols are global by // default. "local" here means in the sense of the dynamic linker, i.e. not // visible outside of the module (shared library or executable) that contains its // definition. (When not compiling to support Go shared libraries, all symbols are // local in this sense unless there is a cgo_export_* directive). AttrLocal // For function symbols; indicates that the specified function was the // target of an inline during compilation AttrWasInlined )