Mercurial > hg-old > index.cgi
annotate lwlink/lwlink.h @ 417:f792faf877bb
Fixed minor layout glitch in listing code
author | lost@l-w.ca |
---|---|
date | Tue, 10 Aug 2010 23:08:07 -0600 |
parents | 54499b799779 |
children |
rev | line source |
---|---|
339 | 1 /* |
2 lwlink.h | |
3 Copyright © 2009 William Astle | |
4 | |
5 This file is part of LWLINK. | |
6 | |
7 LWLINK is free software: you can redistribute it and/or modify it under the | |
8 terms of the GNU General Public License as published by the Free Software | |
9 Foundation, either version 3 of the License, or (at your option) any later | |
10 version. | |
11 | |
12 This program is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
15 more details. | |
16 | |
17 You should have received a copy of the GNU General Public License along with | |
18 this program. If not, see <http://www.gnu.org/licenses/>. | |
19 | |
20 Contains the main defs used by the linker | |
21 */ | |
22 | |
23 | |
24 #ifndef __lwlink_h_seen__ | |
25 #define __lwlink_h_seen__ | |
26 | |
27 #include "expr.h" | |
28 | |
29 #define OUTPUT_DECB 0 // DECB multirecord format | |
30 #define OUTPUT_RAW 1 // raw sequence of bytes | |
31 #define OUTPUT_LWEX0 2 // LWOS LWEX binary version 0 | |
32 | |
33 typedef struct symtab_s symtab_t; | |
34 struct symtab_s | |
35 { | |
36 unsigned char *sym; // symbol name | |
37 int offset; // local offset | |
38 // int realval; // resolved value | |
39 symtab_t *next; // next symbol | |
40 }; | |
41 | |
42 #define RELOC_NORM 0 // all default (16 bit) | |
43 #define RELOC_8BIT 1 // only use the low 8 bits for the reloc | |
44 typedef struct reloc_s reloc_t; | |
45 struct reloc_s | |
46 { | |
47 int offset; // where in the section | |
48 int flags; // flags for the relocation | |
49 lw_expr_stack_t *expr; // the expression to calculate it | |
50 reloc_t *next; // ptr to next relocation | |
51 }; | |
52 | |
53 typedef struct fileinfo_s fileinfo_t; | |
54 | |
55 #define SECTION_BSS 1 | |
56 typedef struct | |
57 { | |
58 unsigned char *name; // name of the section | |
59 int flags; // section flags | |
60 int codesize; // size of the code | |
61 unsigned char *code; // pointer to the code | |
62 int loadaddress; // the actual load address of the section | |
63 int processed; // was the section processed yet? | |
64 | |
65 symtab_t *localsyms; // local symbol table | |
66 symtab_t *exportedsyms; // exported symbols table | |
67 | |
68 reloc_t *incompletes; // table of incomplete references | |
69 | |
70 fileinfo_t *file; // the file we are in | |
71 } section_t; | |
72 | |
73 struct fileinfo_s | |
74 { | |
75 char *filename; | |
76 unsigned char *filedata; | |
77 long filesize; | |
78 section_t *sections; | |
79 int nsections; | |
80 int islib; // set to true if the file is a "-l" option | |
81 | |
82 int forced; // set to true if the file is a "forced" include | |
83 | |
84 // "sub" files (like in archives or libraries) | |
85 int nsubs; | |
86 fileinfo_t **subs; | |
87 fileinfo_t *parent; | |
88 }; | |
89 | |
90 struct section_list | |
91 { | |
92 section_t *ptr; // ptr to section structure | |
93 int forceaddr; // was this force to an address by the link script? | |
94 }; | |
95 | |
96 #ifndef __link_c_seen__ | |
97 extern struct section_list *sectlist; | |
98 extern int nsects; | |
99 #endif | |
100 | |
101 | |
102 #ifndef __lwlink_c_seen__ | |
103 | |
104 extern int debug_level; | |
105 extern int outformat; | |
106 extern char *outfile; | |
107 extern int ninputfiles; | |
108 extern fileinfo_t **inputfiles; | |
109 extern char *scriptfile; | |
110 | |
111 extern int nlibdirs; | |
112 extern char **libdirs; | |
113 | |
114 extern int nscriptls; | |
115 extern char **scriptls; | |
116 | |
117 extern int symerr; | |
118 | |
119 extern char *map_file; | |
120 | |
121 #define __lwlink_E__ extern | |
122 #else | |
123 #define __lwlink_E__ | |
124 #endif // __lwlink_c_seen__ | |
125 | |
126 __lwlink_E__ void add_input_file(char *fn); | |
127 __lwlink_E__ void add_input_library(char *fn); | |
128 __lwlink_E__ void add_library_search(char *fn); | |
129 __lwlink_E__ void add_section_base(char *fn); | |
395
54499b799779
Q&D sanitization of symbols in map files and error messages in lwlink
lost@l-w.ca
parents:
378
diff
changeset
|
130 __lwlink_E__ char *sanitize_symbol(char *sym); |
339 | 131 |
132 #undef __lwlink_E__ | |
133 | |
134 struct scriptline_s | |
135 { | |
136 char *sectname; // name of section, NULL for wildcard | |
137 int loadat; // address to load at (or -1) | |
138 int noflags; // flags to NOT have | |
139 int yesflags; // flags to HAVE | |
140 }; | |
141 | |
142 typedef struct | |
143 { | |
144 int nlines; // number of lines in the script | |
145 struct scriptline_s *lines; // the parsed script lines (section) | |
146 int padsize; // the size to pad to, -1 for none | |
147 char *execsym; // entry point symbol | |
148 int execaddr; // execution address (entry point) | |
149 int stacksize; // stack size | |
150 } linkscript_t; | |
151 | |
152 #ifndef __script_c_seen__ | |
153 extern linkscript_t linkscript; | |
154 #endif | |
155 | |
156 #endif //__lwlink_h_seen__ |