Documentation ¶
Index ¶
- Constants
- Variables
- func Adduint32(ctxt *Link, s *LSym, v uint32) int64
- func Adduint64(ctxt *Link, s *LSym, v uint64) int64
- func Bflush(b *Biobuf)
- func Bgetc(b *Biobuf) int
- func Boffset(b *Biobuf) int64
- func Bprint(b *Biobuf, format string, args ...interface{})
- func Bputc(b *Biobuf, c int)
- func Bread(b *Biobuf, buf []byte) int
- func Bungetc(b *Biobuf)
- func Bwrite(b *Biobuf, buf []byte) int
- func Cputime() float64
- func Getgoarch() string
- func Getgoarm() string
- func Getgoos() string
- func Getgoroot() string
- func Getgoversion() string
- func Headstr(v int) string
- func Symgrow(ctxt *Link, s *LSym, lsiz int64)
- func Writeobj(ctxt *Link, b *Biobuf)
- type Addr
- type Auto
- type Biobuf
- type Hist
- type LSym
- type Library
- type Link
- type LinkArch
- type Pcdata
- type Pciter
- type Pcln
- type Plist
- type Prog
- type Reloc
- type Rune
Constants ¶
const ( OREAD = iota OWRITE ORDWR SIGBUS SIGSEGV NDFLT FPPDBL FPRNR BOM HEADER_IO )
const ( Sxxx = iota STEXT SELFRXSECT STYPE SSTRING SGOSTRING SGOFUNC SRODATA SFUNCTAB STYPELINK SSYMTAB SPCLNTAB SELFROSECT SMACHOPLT SELFSECT SMACHO SMACHOGOT SNOPTRDATA SINITARR SDATA SWINDOWS SBSS SNOPTRBSS STLSBSS SXREF SMACHOSYMSTR SMACHOSYMTAB SMACHOINDIRECTPLT SMACHOINDIRECTGOT SFILE SFILEPATH SCONST SDYNIMPORT SHOSTOBJ SSUB = 1 << 8 SMASK = SSUB - 1 SHIDDEN = 1 << 9 )
LSym.type
const ( R_ADDR = 1 + iota R_SIZE R_CALL R_CALLARM R_CALLIND R_CONST R_PCREL R_TLS R_TLS_LE R_TLS_IE R_GOTOFF R_PLT0 R_PLT1 R_PLT2 R_USEFIELD )
Reloc.type
const ( A_AUTO = 1 + iota A_PARAM )
Auto.type
const ( Hunknown = 0 + iota Hdarwin Hdragonfly Helf Hfreebsd Hlinux Hnacl Hnetbsd Hopenbsd Hplan9 Hsolaris Hwindows )
executable header types
const ( LinkAuto = 0 + iota LinkInternal LinkExternal )
const ( HISTSZ = 10 NSYM = 50 )
Copyright 2009 The Go Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
const ( StackSystem = 0 StackExtra = 2048 StackMin = 8192 StackSystemRounded = StackSystem + (-StackSystem & (StackMin - 1)) FixedStack = StackMin + StackSystemRounded StackBig = 4096 StackGuard = 256 + StackSystem StackSmall = 128 StackLimit = StackGuard - StackSystem - StackSmall StackTop = 88 )
Copyright 2011 The Go Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Stack layout parameters. Included both by runtime (compiled via 6c) and linkers (compiled via gcc).
The per-goroutine g->stackguard is set to point StackGuard bytes above the bottom of the stack. Each function compares its stack pointer against g->stackguard to check for overflow. To cut one instruction from the check sequence for functions with tiny frames, the stack is allowed to protrude StackSmall bytes below the stack guard. Functions with large frames don't bother with the check and always call morestack. The sequences are (for amd64, others are similar):
guard = g->stackguard frame = function's stack frame size argsize = size of function arguments (call + return) stack frame size <= StackSmall: CMPQ guard, SP JHI 3(PC) MOVQ m->morearg, $(argsize << 32) CALL morestack(SB) stack frame size > StackSmall but < StackBig LEAQ (frame-StackSmall)(SP), R0 CMPQ guard, R0 JHI 3(PC) MOVQ m->morearg, $(argsize << 32) CALL morestack(SB) stack frame size >= StackBig: MOVQ m->morearg, $((argsize << 32) | frame) CALL morestack(SB)
The bottom StackGuard - StackSmall bytes are important: there has to be enough room to execute functions that refuse to check for stack overflow, either because they need to be adjacent to the actual caller's frame (deferproc) or because they handle the imminent stack overflow (morestack).
For example, deferproc might call malloc, which does one of the above checks (without allocating a full frame), which might trigger a call to morestack. This sequence needs to fit in the bottom section of the stack. On amd64, morestack's frame is 40 bytes, and deferproc's frame is 56 bytes. That fits well within the StackGuard - StackSmall = 128 bytes at the bottom. The linkers explore all possible call traces involving non-splitting functions to make sure that this limit cannot be violated.
const ( NOPROF = 1 DUPOK = 2 NOSPLIT = 4 RODATA = 8 NOPTR = 16 WRAPPER = 32 NEEDCTXT = 64 )
Copyright 2013 The Go Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. This file defines flags attached to various functions and data objects. The compilers, assemblers, and linker must all agree on these values. Don't profile the marked routine. This flag is deprecated. It is ok for the linker to get multiple of these symbols. It will pick one of the duplicates to use. Don't insert stack check preamble. Put this data in a read-only section. This data contains no pointers. This is a wrapper function and should not count as disabling 'recover'. This function uses its incoming context register.
const ( UTFmax = 4 Runesync = 0x80 Runeself = 0x80 Runeerror = 0xFFFD Runemax = 0x10FFFF )
const ( NOPROF_textflag = 1 DUPOK_textflag = 2 NOSPLIT_textflag = 4 RODATA_textflag = 8 NOPTR_textflag = 16 WRAPPER_textflag = 32 NEEDCTXT_textflag = 64 )
const (
AEXIST = 0
)
const (
HistVersion = 1
)
symbol version, incremented each time a file is loaded. version==1 is reserved for savehist.
const (
LINKHASH = 100003
)
const (
LOG = 5
)
const (
StackPreempt = -1314
)
Goroutine preemption request. Stored into g->stackguard0 to cause split stack check failure. Must be greater than any real sp. 0xfffffade in hex.
Variables ¶
var GOEXPERIMENT string
Functions ¶
func Getgoversion ¶
func Getgoversion() string
Types ¶
type Addr ¶
type Addr struct { Offset int64 U struct { Sval string Dval float64 Branch *Prog } Sym *LSym Gotype *LSym Typ int Index int Scale int8 Reg int Name int Class int Etype uint8 Offset2 int Node *struct{} Width int64 }
Derived from Inferno utils/6l/l.h and related files. http://code.google.com/p/inferno-os/source/browse/utils/6l/l.h
Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved. Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net) Portions Copyright © 1997-1999 Vita Nuova Limited Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuova.com) Portions Copyright © 2004,2006 Bruce Ellis Portions Copyright © 2005-2007 C H Forsyth (forsyth@terzarima.net) Revisions Copyright © 2000-2007 Lucent Technologies Inc. and others Portions Copyright © 2009 The Go Authors. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
type LSym ¶
type LSym struct { Name string Extname string Typ int Version uint32 Dupok int External uint8 Nosplit uint8 Reachable uint8 Cgoexport uint8 Special uint8 Stkcheck uint8 Hide uint8 Leaf uint8 Fnptr uint8 Seenglobl uint8 Onlist uint8 Printed uint8 Symid int16 Dynid int Sig int Plt int Got int Align int Elfsym int Args int Locals int64 Value int64 Size int64 Hash *LSym 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 []uint8 R []Reloc }
type Link ¶
type Link struct { Thechar int Thestring string Goarm int Headtype int Arch *LinkArch Ignore func(string) int Debugasm int Debugline int Debughist int Debugread int Debugvlog int Debugstack int Debugzerostack int Debugdivmod int Debugfloat int Debugpcln int Iself int Bso *Biobuf Pathname string Windows int Trimpath string Goroot string Goroot_final string Hash [LINKHASH]*LSym Allsym *LSym Nsymbol int Hist *Hist Ehist *Hist Plist *Plist Plast *Plist Sym_div *LSym Sym_divu *LSym Sym_mod *LSym Sym_modu *LSym Symmorestack [20]*LSym Tlsg *LSym Plan9privates *LSym Curp *Prog Printp *Prog Blitrl *Prog Elitrl *Prog Rexflag int Rep int Repn int Lock int Asmode int Andptr []uint8 And [100]uint8 Instoffset int Autosize int Armsize int Pc int64 Libdir []string Library []Library Tlsoffset int Diag func(string, ...interface{}) Mode int Curauto *Auto Curhist *Auto Cursym *LSym Version uint32 Textp *LSym Etextp *LSym Histdepth int Nhistfile int Filesyms *LSym }
type LinkArch ¶
type LinkArch struct { Name string Thechar int ByteOrder binary.ByteOrder Pconv func(*Prog) string Addstacksplit func(*Link, *LSym) Assemble func(*Link, *LSym) Datasize func(*Prog) int Follow func(*Link, *LSym) Iscall func(*Prog) int Isdata func(*Prog) int Prg func() *Prog Progedit func(*Link, *Prog) Settextflag func(*Prog, int) Symtype func(*Addr) int Textflag func(*Prog) int Minlc uint32 Ptrsize int64 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 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 Prog ¶
type Prog struct { Ctxt *Link Pc int64 Lineno int Link *Prog As int Reg int Scond int From Addr To Addr Opt *struct{} Forwd *Prog Pcond *Prog Comefrom *Prog Pcrel *Prog Spadj int64 Mark int Back int Ft uint8 Tt uint8 Optab int Isize int Printed uint8 Width int8 Mode int TEXTFLAG uint8 }
func Brchain ¶
Inferno utils/6l/pass.c http://code.google.com/p/inferno-os/source/browse/utils/6l/pass.c
Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved. Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net) Portions Copyright © 1997-1999 Vita Nuova Limited Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuova.com) Portions Copyright © 2004,2006 Bruce Ellis Portions Copyright © 2005-2007 C H Forsyth (forsyth@terzarima.net) Revisions Copyright © 2000-2007 Lucent Technologies Inc. and others Portions Copyright © 2009 The Go Authors. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Code and data passes.
type Reloc ¶
type Rune ¶
type Rune uint /* Code-point values in Unicode 4.0 are 21 bits wide.*/
* The authors of this software are Rob Pike and Ken Thompson. * Copyright (c) 2002 by Lucent Technologies. * Permission to use, copy, modify, and distribute this software for any * purpose without fee is hereby granted, provided that this entire notice * is included in all copies of any software which is or includes a copy * or modification of this software and in all copies of the supporting * documentation for such software. * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED * WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE ANY * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
* The authors of this software are Rob Pike and Ken Thompson. * Copyright (c) 1998-2002 by Lucent Technologies. * Portions Copyright (c) 2009 The Go Authors. All rights reserved. * Permission to use, copy, modify, and distribute this software for any * purpose without fee is hereby granted, provided that this entire notice * is included in all copies of any software which is or includes a copy * or modification of this software and in all copies of the supporting * documentation for such software. * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED * WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE ANY * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.