Mercurial > hg-old > index.cgi
annotate lwlink/lwlink.h @ 264:61d1db1dfe2a 2.6
Build manual for release
author | lost |
---|---|
date | Tue, 22 Dec 2009 05:27:32 +0000 |
parents | e8d70b95ec41 |
children |
rev | line source |
---|---|
112 | 1 /* |
2 lwlink.h | |
118 | 3 Copyright © 2009 William Astle |
112 | 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 | |
116 | 27 #include "expr.h" |
28 | |
112 | 29 #define OUTPUT_DECB 0 // DECB multirecord format |
30 #define OUTPUT_RAW 1 // raw sequence of bytes | |
187 | 31 #define OUTPUT_LWEX0 2 // LWOS LWEX binary version 0 |
112 | 32 |
116 | 33 typedef struct symtab_s symtab_t; |
34 struct symtab_s | |
35 { | |
36 unsigned char *sym; // symbol name | |
37 int offset; // local offset | |
120 | 38 // int realval; // resolved value |
116 | 39 symtab_t *next; // next symbol |
40 }; | |
41 | |
204
048ebb85f6ef
Added 8 bit external references for base page addressing mode
lost
parents:
187
diff
changeset
|
42 #define RELOC_NORM 0 // all default (16 bit) |
048ebb85f6ef
Added 8 bit external references for base page addressing mode
lost
parents:
187
diff
changeset
|
43 #define RELOC_8BIT 1 // only use the low 8 bits for the reloc |
243 | 44 #define RELOC_0BIT 2 // don't actual stuff a reloc anywhere! |
116 | 45 typedef struct reloc_s reloc_t; |
46 struct reloc_s | |
47 { | |
48 int offset; // where in the section | |
204
048ebb85f6ef
Added 8 bit external references for base page addressing mode
lost
parents:
187
diff
changeset
|
49 int flags; // flags for the relocation |
116 | 50 lw_expr_stack_t *expr; // the expression to calculate it |
51 reloc_t *next; // ptr to next relocation | |
52 }; | |
53 | |
119 | 54 typedef struct fileinfo_s fileinfo_t; |
55 | |
116 | 56 #define SECTION_BSS 1 |
57 typedef struct | |
58 { | |
59 unsigned char *name; // name of the section | |
60 int flags; // section flags | |
61 int codesize; // size of the code | |
62 unsigned char *code; // pointer to the code | |
63 int loadaddress; // the actual load address of the section | |
119 | 64 int processed; // was the section processed yet? |
65 | |
116 | 66 symtab_t *localsyms; // local symbol table |
67 symtab_t *exportedsyms; // exported symbols table | |
68 | |
69 reloc_t *incompletes; // table of incomplete references | |
119 | 70 |
71 fileinfo_t *file; // the file we are in | |
116 | 72 } section_t; |
115 | 73 |
119 | 74 struct fileinfo_s |
115 | 75 { |
76 char *filename; | |
77 unsigned char *filedata; | |
78 long filesize; | |
116 | 79 section_t *sections; |
80 int nsections; | |
180 | 81 int islib; // set to true if the file is a "-l" option |
171 | 82 |
205 | 83 int forced; // set to true if the file is a "forced" include |
248
e8d70b95ec41
Fixed various problems with determining which files to include in the output and also fixed problem identifying which files actually resolved symbols
lost
parents:
243
diff
changeset
|
84 int resolves; // set to true if the file resolves a symbol |
205 | 85 |
171 | 86 // "sub" files (like in archives or libraries) |
87 int nsubs; | |
88 fileinfo_t **subs; | |
89 fileinfo_t *parent; | |
119 | 90 }; |
115 | 91 |
121 | 92 struct section_list |
93 { | |
94 section_t *ptr; // ptr to section structure | |
95 int forceaddr; // was this force to an address by the link script? | |
96 }; | |
97 | |
98 #ifndef __link_c_seen__ | |
99 extern struct section_list *sectlist; | |
100 extern int nsects; | |
101 #endif | |
116 | 102 |
103 | |
112 | 104 #ifndef __lwlink_c_seen__ |
105 | |
106 extern int debug_level; | |
107 extern int outformat; | |
108 extern char *outfile; | |
114
c65fcec346cd
Handle input files on command line and add some memory management utility functions
lost
parents:
112
diff
changeset
|
109 extern int ninputfiles; |
115 | 110 extern fileinfo_t **inputfiles; |
117 | 111 extern char *scriptfile; |
112 | 112 |
180 | 113 extern int nlibdirs; |
114 extern char **libdirs; | |
115 | |
116 extern int nscriptls; | |
117 extern char **scriptls; | |
118 | |
184
220a760ec654
Make lwlink display all undefined references instead of bailing after the first one
lost
parents:
180
diff
changeset
|
119 extern int symerr; |
220a760ec654
Make lwlink display all undefined references instead of bailing after the first one
lost
parents:
180
diff
changeset
|
120 |
185 | 121 extern char *map_file; |
122 | |
114
c65fcec346cd
Handle input files on command line and add some memory management utility functions
lost
parents:
112
diff
changeset
|
123 #define __lwlink_E__ extern |
c65fcec346cd
Handle input files on command line and add some memory management utility functions
lost
parents:
112
diff
changeset
|
124 #else |
c65fcec346cd
Handle input files on command line and add some memory management utility functions
lost
parents:
112
diff
changeset
|
125 #define __lwlink_E__ |
112 | 126 #endif // __lwlink_c_seen__ |
127 | |
114
c65fcec346cd
Handle input files on command line and add some memory management utility functions
lost
parents:
112
diff
changeset
|
128 __lwlink_E__ void add_input_file(char *fn); |
180 | 129 __lwlink_E__ void add_input_library(char *fn); |
130 __lwlink_E__ void add_library_search(char *fn); | |
131 __lwlink_E__ void add_section_base(char *fn); | |
114
c65fcec346cd
Handle input files on command line and add some memory management utility functions
lost
parents:
112
diff
changeset
|
132 |
c65fcec346cd
Handle input files on command line and add some memory management utility functions
lost
parents:
112
diff
changeset
|
133 #undef __lwlink_E__ |
117 | 134 |
135 struct scriptline_s | |
136 { | |
137 char *sectname; // name of section, NULL for wildcard | |
138 int loadat; // address to load at (or -1) | |
139 int noflags; // flags to NOT have | |
140 int yesflags; // flags to HAVE | |
141 }; | |
142 | |
143 typedef struct | |
144 { | |
145 int nlines; // number of lines in the script | |
146 struct scriptline_s *lines; // the parsed script lines (section) | |
147 int padsize; // the size to pad to, -1 for none | |
121 | 148 char *execsym; // entry point symbol |
149 int execaddr; // execution address (entry point) | |
187 | 150 int stacksize; // stack size |
117 | 151 } linkscript_t; |
152 | |
153 #ifndef __script_c_seen__ | |
154 extern linkscript_t linkscript; | |
155 #endif | |
156 | |
112 | 157 #endif //__lwlink_h_seen__ |