liblink

package
v0.0.0-...-07015bd Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2017 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FmtWidth    = 1
	FmtLeft     = FmtWidth << 1
	FmtPrec     = FmtLeft << 1
	FmtSharp    = FmtPrec << 1
	FmtSpace    = FmtSharp << 1
	FmtSign     = FmtSpace << 1
	FmtApost    = FmtSign << 1
	FmtZero     = FmtApost << 1
	FmtUnsigned = FmtZero << 1
	FmtShort    = FmtUnsigned << 1
	FmtLong     = FmtShort << 1
	FmtVLong    = FmtLong << 1
	FmtComma    = FmtVLong << 1
	FmtByte     = FmtComma << 1
	FmtLDouble  = FmtByte << 1
	FmtFlag     = FmtLDouble << 1
)
View Source
const (
	PCDATA_StackMapIndex       = 0
	FUNCDATA_ArgsPointerMaps   = 0
	FUNCDATA_LocalsPointerMaps = 1
	FUNCDATA_DeadValueMaps     = 2
	ArgsSizeUnknown            = 0x80000000
)

ArgsSizeUnknown is set in Func.argsize to mark all functions whose argument size is unknown (C vararg functions, and assembly code without an explicit specification). This value is generated by the compiler, assembler, or linker.

View Source
const (
	Sxxx = iota
	STEXT
	SELFRXSECT
	STYPE
	SSTRING
	SGOSTRING
	SGOFUNC
	SRODATA
	SFUNCTAB
	STYPELINK
	SSYMTAB
	SPCLNTAB
	SELFROSECT
	SMACHOPLT
	SELFSECT
	SMACHO
	SMACHOGOT
	SWINDOWS
	SELFGOT
	SNOPTRDATA
	SINITARR
	SDATA
	SBSS
	SNOPTRBSS
	STLSBSS
	SXREF
	SMACHOSYMSTR
	SMACHOSYMTAB
	SMACHOINDIRECTPLT
	SMACHOINDIRECTGOT
	SFILE
	SFILEPATH
	SCONST
	SDYNIMPORT
	SHOSTOBJ
	SSUB    = 1 << 8
	SMASK   = SSUB - 1
	SHIDDEN = 1 << 9
)

LSym.type

View Source
const (
	R_ADDR = 1 + iota
	R_ADDRPOWER
	R_SIZE
	R_CALL
	R_CALLARM
	R_CALLIND
	R_CALLPOWER
	R_CONST
	R_PCREL
	R_TLS
	R_TLS_LE
	R_TLS_IE
	R_GOTOFF
	R_PLT0
	R_PLT1
	R_PLT2
	R_USEFIELD
	R_POWER_TOC
)

Reloc.type

View Source
const (
	RV_NONE = iota
	RV_POWER_LO
	RV_POWER_HI
	RV_POWER_HA
	RV_POWER_DS
	RV_CHECK_OVERFLOW = 1 << 8
	RV_TYPE_MASK      = RV_CHECK_OVERFLOW - 1
)

Reloc.variant

View Source
const (
	A_AUTO = 1 + iota
	A_PARAM
)

Auto.type

View Source
const (
	LittleEndian = 0x04030201
	BigEndian    = 0x01020304
)
View Source
const (
	Hunknown = 0 + iota
	Hdarwin
	Hdragonfly
	Helf
	Hfreebsd
	Hlinux
	Hnacl
	Hnetbsd
	Hopenbsd
	Hplan9
	Hsolaris
	Hwindows
)

executable header types

View Source
const (
	LinkAuto = 0 + iota
	LinkInternal
	LinkExternal
)
View Source
const (
	HISTSZ = 10
	NSYM   = 50
)
View Source
const (
	StackSystem = 0
	StackBig    = 4096
	StackGuard  = 640 + StackSystem
	StackSmall  = 128
	StackLimit  = StackGuard - StackSystem - StackSmall
)
View Source
const (
	// Don't profile the marked routine.  This flag is deprecated.
	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
)
View Source
const (
	HistVersion = 1
)

symbol version, incremented each time a file is loaded. version==1 is reserved for savehist.

View Source
const (
	LINKHASH = 100003
)
View Source
const (
	LOG = 5
)
View Source
const (
	StackPreempt = -1314 // 0xfff...fade
)

Variables

This section is empty.

Functions

func Adduint32

func Adduint32(ctxt *Link, s *LSym, v uint32) int64

func Adduint64

func Adduint64(ctxt *Link, s *LSym, v uint64) int64

func Atoi

func Atoi(s string) int

func Bflush

func Bflush(b *Biobuf) error

func Bgetc

func Bgetc(b *Biobuf) int

func Boffset

func Boffset(b *Biobuf) int64

func Bputc

func Bputc(b *Biobuf, c byte)

func Bungetc

func Bungetc(b *Biobuf)

func Bwrite

func Bwrite(b *Biobuf, p []byte) (int, error)

func Cputime

func Cputime() float64

func Getgoarch

func Getgoarch() string

func Getgoarm

func Getgoarm() string

func Getgoos

func Getgoos() string

func Getgoroot

func Getgoroot() string

func Headstr

func Headstr(v int) string

func Symgrow

func Symgrow(ctxt *Link, s *LSym, lsiz int64)

func Writeobjdirect

func Writeobjdirect(ctxt *Link, b *Biobuf)

The Go and C compilers, and the assembler, call writeobj to write out a Go object file. The linker does not call this; the linker does not write out object files.

Types

type Addr

type Addr struct {
	Offset int64
	U      struct {
		Sval   string
		Dval   float64
		Branch *Prog
	}
	Sym     *LSym
	Gotype  *LSym
	Type_   int16
	Index   uint8
	Scale   int8
	Reg     int8
	Name    int8
	Class   int8
	Etype   uint8
	Offset2 int32
	Node    *struct{}
	Width   int64
}

type Auto

type Auto struct {
	Asym    *LSym
	Link    *Auto
	Aoffset int32
	Type_   int16
	Gotype  *LSym
}

type Biobuf

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

func Binitw

func Binitw(w io.Writer) *Biobuf

func (*Biobuf) Flush

func (b *Biobuf) Flush() error

func (*Biobuf) Write

func (b *Biobuf) Write(p []byte) (int, error)

type Fmt

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

type Hist

type Hist struct {
	Link    *Hist
	Name    string
	Line    int32
	Offset  int32
	Printed uint8
}

type LSym

type LSym struct {
	Name        string
	Extname     string
	Type_       int16
	Version     int16
	Dupok       uint8
	Cfunc       uint8
	External    uint8
	Nosplit     uint8
	Reachable   uint8
	Cgoexport   uint8
	Special     uint8
	Stkcheck    uint8
	Hide        uint8
	Leaf        uint8
	Fnptr       uint8
	Localentry  uint8
	Seenglobl   uint8
	Onlist      uint8
	Printed     uint8
	Symid       int16
	Dynid       int32
	Sig         int32
	Plt         int32
	Got         int32
	Align       int32
	Elfsym      int32
	Args        int32
	Locals      int32
	Value       int64
	Size        int64
	Allsym      *LSym
	Next        *LSym
	Sub         *LSym
	Outer       *LSym
	Gotype      *LSym
	Reachparent *LSym
	Queue       *LSym
	File        string
	Dynimplib   string
	Dynimpvers  string
	Sect        *struct{}
	Autom       *Auto
	Text        *Prog
	Etext       *Prog
	Pcln        *Pcln
	P           []byte
	R           []Reloc
}

func Linklookup

func Linklookup(ctxt *Link, name string, v int) *LSym

type Library

type Library struct {
	Objref string
	Srcref string
	File   string
	Pkg    string
}
type Link struct {
	Thechar            int32
	Thestring          string
	Goarm              int32
	Headtype           int
	Arch               *LinkArch
	Ignore             func(string) int32
	Debugasm           int32
	Debugline          int32
	Debughist          int32
	Debugread          int32
	Debugvlog          int32
	Debugstack         int32
	Debugzerostack     int32
	Debugdivmod        int32
	Debugfloat         int32
	Debugpcln          int32
	Flag_shared        int32
	Iself              int32
	Bso                *Biobuf
	Pathname           string
	Windows            int32
	Trimpath           string
	Goroot             string
	Goroot_final       string
	Enforce_data_order int32
	Allsym             *LSym
	Nsymbol            int32
	Hist               *Hist
	Ehist              *Hist
	Plist              *Plist
	Plast              *Plist
	Sym_div            *LSym
	Sym_divu           *LSym
	Sym_mod            *LSym
	Sym_modu           *LSym
	Symmorestack       [2]*LSym
	Tlsg               *LSym
	Plan9privates      *LSym
	Curp               *Prog
	Printp             *Prog
	Blitrl             *Prog
	Elitrl             *Prog
	Rexflag            int
	Rep                int
	Repn               int
	Lock               int
	Asmode             int
	Andptr             []byte
	And                [100]uint8
	Instoffset         int64
	Autosize           int32
	Armsize            int32
	Pc                 int64
	Libdir             []string
	Library            []Library
	Tlsoffset          int
	Diag               func(string, ...interface{})
	Mode               int
	Curauto            *Auto
	Curhist            *Auto
	Cursym             *LSym
	Version            int
	Textp              *LSym
	Etextp             *LSym
	Histdepth          int32
	Nhistfile          int32
	Filesyms           *LSym
	Hash               map[NameVers]*LSym
}

func Linknew

func Linknew(arch *LinkArch) *Link

type LinkArch

type LinkArch struct {
	Pconv         func(*Prog) string
	Name          string
	Thechar       int
	Endian        int32
	ByteOrder     binary.ByteOrder
	Addstacksplit func(*Link, *LSym)
	Assemble      func(*Link, *LSym)
	Datasize      func(*Prog) int
	Follow        func(*Link, *LSym)
	Iscall        func(*Prog) bool
	Isdata        func(*Prog) bool
	Prg           func() *Prog
	Progedit      func(*Link, *Prog)
	Settextflag   func(*Prog, int)
	Symtype       func(*Addr) int
	Textflag      func(*Prog) int
	Minlc         int
	Ptrsize       int
	Regsize       int
	D_ADDR        int
	D_AUTO        int
	D_BRANCH      int
	D_CONST       int
	D_EXTERN      int
	D_FCONST      int
	D_NONE        int
	D_PARAM       int
	D_SCONST      int
	D_STATIC      int
	D_OREG        int
	ACALL         int
	ADATA         int
	AEND          int
	AFUNCDATA     int
	AGLOBL        int
	AJMP          int
	ANOP          int
	APCDATA       int
	ARET          int
	ATEXT         int
	ATYPE         int
	AUSEFIELD     int
}

type NameVers

type NameVers struct {
	Name string
	Vers int
}

type Pcdata

type Pcdata struct {
	P []byte
}

type Pciter

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

type Pcln

type Pcln struct {
	Pcsp        Pcdata
	Pcfile      Pcdata
	Pcline      Pcdata
	Pcdata      []Pcdata
	Funcdata    []*LSym
	Funcdataoff []int64
	File        []*LSym
	Lastfile    *LSym
	Lastindex   int
}

type Plist

type Plist struct {
	Name    *LSym
	Firstpc *Prog
	Recur   int
	Link    *Plist
}

type Prog

type Prog struct {
	Ctxt     *Link
	Pc       int64
	Lineno   int32
	Link     *Prog
	As       int16
	Scond    uint8
	From     Addr
	Reg      uint8
	From3    Addr
	To       Addr
	Opt      interface{}
	Forwd    *Prog
	Pcond    *Prog
	Comefrom *Prog
	Pcrel    *Prog
	Spadj    int32
	Mark     uint16
	Optab    uint16
	Back     uint8
	Ft       uint8
	Tt       uint8
	Isize    uint8
	Printed  uint8
	Width    int8
	Mode     int8
	TEXTFLAG uint8
}

func Appendp

func Appendp(ctxt *Link, q *Prog) *Prog

func Brchain

func Brchain(ctxt *Link, p *Prog) *Prog

func Copyp

func Copyp(ctxt *Link, q *Prog) *Prog

func (*Prog) Line

func (p *Prog) Line() string

func (*Prog) String

func (p *Prog) String() string

type Reloc

type Reloc struct {
	Off     int32
	Siz     uint8
	Done    uint8
	Type_   int32
	Variant int32
	Add     int64
	Xadd    int64
	Sym     *LSym
	Xsym    *LSym
}

func Addrel

func Addrel(s *LSym) *Reloc

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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