Mercurial > hg-old > index.cgi
annotate lwlink/lwlink.h @ 184:220a760ec654
Make lwlink display all undefined references instead of bailing after the first one
author | lost |
---|---|
date | Sat, 21 Mar 2009 17:39:45 +0000 |
parents | 6ebb93b409ba |
children | b89adfb0d174 |
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 | |
31 | |
116 | 32 typedef struct symtab_s symtab_t; |
33 struct symtab_s | |
34 { | |
35 unsigned char *sym; // symbol name | |
36 int offset; // local offset | |
120 | 37 // int realval; // resolved value |
116 | 38 symtab_t *next; // next symbol |
39 }; | |
40 | |
41 typedef struct reloc_s reloc_t; | |
42 struct reloc_s | |
43 { | |
44 int offset; // where in the section | |
45 lw_expr_stack_t *expr; // the expression to calculate it | |
46 reloc_t *next; // ptr to next relocation | |
47 }; | |
48 | |
119 | 49 typedef struct fileinfo_s fileinfo_t; |
50 | |
116 | 51 #define SECTION_BSS 1 |
52 typedef struct | |
53 { | |
54 unsigned char *name; // name of the section | |
55 int flags; // section flags | |
56 int codesize; // size of the code | |
57 unsigned char *code; // pointer to the code | |
58 int loadaddress; // the actual load address of the section | |
119 | 59 int processed; // was the section processed yet? |
60 | |
116 | 61 symtab_t *localsyms; // local symbol table |
62 symtab_t *exportedsyms; // exported symbols table | |
63 | |
64 reloc_t *incompletes; // table of incomplete references | |
119 | 65 |
66 fileinfo_t *file; // the file we are in | |
116 | 67 } section_t; |
115 | 68 |
119 | 69 struct fileinfo_s |
115 | 70 { |
71 char *filename; | |
72 unsigned char *filedata; | |
73 long filesize; | |
116 | 74 section_t *sections; |
75 int nsections; | |
180 | 76 int islib; // set to true if the file is a "-l" option |
171 | 77 |
78 // "sub" files (like in archives or libraries) | |
79 int nsubs; | |
80 fileinfo_t **subs; | |
81 fileinfo_t *parent; | |
119 | 82 }; |
115 | 83 |
121 | 84 struct section_list |
85 { | |
86 section_t *ptr; // ptr to section structure | |
87 int forceaddr; // was this force to an address by the link script? | |
88 }; | |
89 | |
90 #ifndef __link_c_seen__ | |
91 extern struct section_list *sectlist; | |
92 extern int nsects; | |
93 #endif | |
116 | 94 |
95 | |
112 | 96 #ifndef __lwlink_c_seen__ |
97 | |
98 extern int debug_level; | |
99 extern int outformat; | |
100 extern char *outfile; | |
114
c65fcec346cd
Handle input files on command line and add some memory management utility functions
lost
parents:
112
diff
changeset
|
101 extern int ninputfiles; |
115 | 102 extern fileinfo_t **inputfiles; |
117 | 103 extern char *scriptfile; |
112 | 104 |
180 | 105 extern int nlibdirs; |
106 extern char **libdirs; | |
107 | |
108 extern int nscriptls; | |
109 extern char **scriptls; | |
110 | |
184
220a760ec654
Make lwlink display all undefined references instead of bailing after the first one
lost
parents:
180
diff
changeset
|
111 extern int symerr; |
220a760ec654
Make lwlink display all undefined references instead of bailing after the first one
lost
parents:
180
diff
changeset
|
112 |
114
c65fcec346cd
Handle input files on command line and add some memory management utility functions
lost
parents:
112
diff
changeset
|
113 #define __lwlink_E__ extern |
c65fcec346cd
Handle input files on command line and add some memory management utility functions
lost
parents:
112
diff
changeset
|
114 #else |
c65fcec346cd
Handle input files on command line and add some memory management utility functions
lost
parents:
112
diff
changeset
|
115 #define __lwlink_E__ |
112 | 116 #endif // __lwlink_c_seen__ |
117 | |
114
c65fcec346cd
Handle input files on command line and add some memory management utility functions
lost
parents:
112
diff
changeset
|
118 __lwlink_E__ void add_input_file(char *fn); |
180 | 119 __lwlink_E__ void add_input_library(char *fn); |
120 __lwlink_E__ void add_library_search(char *fn); | |
121 __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
|
122 |
c65fcec346cd
Handle input files on command line and add some memory management utility functions
lost
parents:
112
diff
changeset
|
123 #undef __lwlink_E__ |
117 | 124 |
125 struct scriptline_s | |
126 { | |
127 char *sectname; // name of section, NULL for wildcard | |
128 int loadat; // address to load at (or -1) | |
129 int noflags; // flags to NOT have | |
130 int yesflags; // flags to HAVE | |
131 }; | |
132 | |
133 typedef struct | |
134 { | |
135 int nlines; // number of lines in the script | |
136 struct scriptline_s *lines; // the parsed script lines (section) | |
137 int padsize; // the size to pad to, -1 for none | |
121 | 138 char *execsym; // entry point symbol |
139 int execaddr; // execution address (entry point) | |
117 | 140 } linkscript_t; |
141 | |
142 #ifndef __script_c_seen__ | |
143 extern linkscript_t linkscript; | |
144 #endif | |
145 | |
112 | 146 #endif //__lwlink_h_seen__ |