github.com/tcnksm/go@v0.0.0-20141208075154-439b32936367/src/cmd/9l/l.h (about) 1 // cmd/9l/l.h from Vita Nuova. 2 // 3 // Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved. 4 // Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net) 5 // Portions Copyright © 1997-1999 Vita Nuova Limited 6 // Portions Copyright © 2000-2008 Vita Nuova Holdings Limited (www.vitanuova.com) 7 // Portions Copyright © 2004,2006 Bruce Ellis 8 // Portions Copyright © 2005-2007 C H Forsyth (forsyth@terzarima.net) 9 // Revisions Copyright © 2000-2008 Lucent Technologies Inc. and others 10 // Portions Copyright © 2009 The Go Authors. All rights reserved. 11 // 12 // Permission is hereby granted, free of charge, to any person obtaining a copy 13 // of this software and associated documentation files (the "Software"), to deal 14 // in the Software without restriction, including without limitation the rights 15 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 // copies of the Software, and to permit persons to whom the Software is 17 // furnished to do so, subject to the following conditions: 18 // 19 // The above copyright notice and this permission notice shall be included in 20 // all copies or substantial portions of the Software. 21 // 22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 // THE SOFTWARE. 29 30 #include <u.h> 31 #include <libc.h> 32 #include <bio.h> 33 #include <link.h> 34 #include "9.out.h" 35 36 #ifndef EXTERN 37 #define EXTERN extern 38 #endif 39 40 enum 41 { 42 thechar = '9', 43 PtrSize = 8, 44 IntSize = 8, 45 RegSize = 8, 46 MaxAlign = 32, // max data alignment 47 FuncAlign = 8 48 }; 49 50 #define P ((Prog*)0) 51 #define S ((LSym*)0) 52 53 enum 54 { 55 FPCHIP = 1, 56 STRINGSZ = 200, 57 MAXHIST = 20, /* limit of path elements for history symbols */ 58 DATBLK = 1024, 59 NHASH = 10007, 60 NHUNK = 100000, 61 MINSIZ = 64, 62 NENT = 100, 63 NSCHED = 20, 64 MINLC = 4, 65 66 Roffset = 22, /* no. bits for offset in relocation address */ 67 Rindex = 10 /* no. bits for index in relocation address */ 68 }; 69 70 EXTERN int32 autosize; 71 EXTERN LSym* datap; 72 EXTERN int debug[128]; 73 EXTERN int32 lcsize; 74 EXTERN char literal[32]; 75 EXTERN int nerrors; 76 EXTERN vlong instoffset; 77 EXTERN char* rpath; 78 EXTERN vlong pc; 79 EXTERN int32 symsize; 80 EXTERN int32 staticgen; 81 EXTERN Prog* lastp; 82 EXTERN vlong textsize; 83 84 void asmb(void); 85 void adddynlib(char *lib); 86 void adddynrel(LSym *s, Reloc *r); 87 void adddynsym(Link *ctxt, LSym *s); 88 int archreloc(Reloc *r, LSym *s, vlong *val); 89 void listinit(void); 90 vlong rnd(vlong, int32); 91 92 #define LPUT(a) (ctxt->arch->endian == BigEndian ? lputb(a):lputl(a)) 93 #define WPUT(a) (ctxt->arch->endian == BigEndian ? wputb(a):wputl(a)) 94 #define VPUT(a) (ctxt->arch->endian == BigEndian ? vputb(a):vputl(a)) 95 96 /* Used by ../ld/dwarf.c */ 97 enum 98 { 99 DWARFREGSP = 1 100 };