Mercurial > hg-old > index.cgi
annotate src/lwlink.h @ 300:48945dac8178
Fixed copyright year
author | lost |
---|---|
date | Wed, 21 Jan 2009 05:13:36 +0000 |
parents | 460d96987670 |
children | 376cc55361c7 |
rev | line source |
---|---|
294 | 1 /* |
2 lwlink.h | |
300 | 3 Copyright © 2009 William Astle |
294 | 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 | |
298 | 27 #include "expr.h" |
28 | |
294 | 29 #define OUTPUT_DECB 0 // DECB multirecord format |
30 #define OUTPUT_RAW 1 // raw sequence of bytes | |
31 | |
298 | 32 typedef struct symtab_s symtab_t; |
33 struct symtab_s | |
34 { | |
35 unsigned char *sym; // symbol name | |
36 int offset; // local offset | |
37 int realval; // resolved value | |
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 | |
49 #define SECTION_BSS 1 | |
50 typedef struct | |
51 { | |
52 unsigned char *name; // name of the section | |
53 int flags; // section flags | |
54 int codesize; // size of the code | |
55 unsigned char *code; // pointer to the code | |
56 int loadaddress; // the actual load address of the section | |
57 | |
58 symtab_t *localsyms; // local symbol table | |
59 symtab_t *exportedsyms; // exported symbols table | |
60 | |
61 reloc_t *incompletes; // table of incomplete references | |
62 } section_t; | |
297 | 63 |
64 typedef struct | |
65 { | |
66 char *filename; | |
67 unsigned char *filedata; | |
68 long filesize; | |
298 | 69 section_t *sections; |
70 int nsections; | |
71 | |
297 | 72 } fileinfo_t; |
73 | |
298 | 74 |
75 | |
294 | 76 #ifndef __lwlink_c_seen__ |
77 | |
78 extern int debug_level; | |
79 extern int outformat; | |
80 extern char *outfile; | |
296
14d835cf02d9
Handle input files on command line and add some memory management utility functions
lost
parents:
294
diff
changeset
|
81 extern int ninputfiles; |
297 | 82 extern fileinfo_t **inputfiles; |
299 | 83 extern char *scriptfile; |
294 | 84 |
296
14d835cf02d9
Handle input files on command line and add some memory management utility functions
lost
parents:
294
diff
changeset
|
85 #define __lwlink_E__ extern |
14d835cf02d9
Handle input files on command line and add some memory management utility functions
lost
parents:
294
diff
changeset
|
86 #else |
14d835cf02d9
Handle input files on command line and add some memory management utility functions
lost
parents:
294
diff
changeset
|
87 #define __lwlink_E__ |
294 | 88 #endif // __lwlink_c_seen__ |
89 | |
296
14d835cf02d9
Handle input files on command line and add some memory management utility functions
lost
parents:
294
diff
changeset
|
90 __lwlink_E__ void add_input_file(char *fn); |
14d835cf02d9
Handle input files on command line and add some memory management utility functions
lost
parents:
294
diff
changeset
|
91 |
14d835cf02d9
Handle input files on command line and add some memory management utility functions
lost
parents:
294
diff
changeset
|
92 #undef __lwlink_E__ |
299 | 93 |
94 struct scriptline_s | |
95 { | |
96 char *sectname; // name of section, NULL for wildcard | |
97 int loadat; // address to load at (or -1) | |
98 int noflags; // flags to NOT have | |
99 int yesflags; // flags to HAVE | |
100 }; | |
101 | |
102 typedef struct | |
103 { | |
104 int nlines; // number of lines in the script | |
105 struct scriptline_s *lines; // the parsed script lines (section) | |
106 int padsize; // the size to pad to, -1 for none | |
107 } linkscript_t; | |
108 | |
109 #ifndef __script_c_seen__ | |
110 extern linkscript_t linkscript; | |
111 #endif | |
112 | |
294 | 113 #endif //__lwlink_h_seen__ |