Mercurial > hg-old > index.cgi
comparison lwlink/lwlink.h @ 139:106c2fe3c9d9
repo reorg
author | lost |
---|---|
date | Wed, 28 Jan 2009 05:59:14 +0000 |
parents | lwlink-old/trunk/src/lwlink.h@050864a47b38 |
children | d610b8aef91b |
comparison
equal
deleted
inserted
replaced
138:050864a47b38 | 139:106c2fe3c9d9 |
---|---|
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 | |
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 typedef struct fileinfo_s fileinfo_t; | |
50 | |
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 | |
59 int processed; // was the section processed yet? | |
60 | |
61 symtab_t *localsyms; // local symbol table | |
62 symtab_t *exportedsyms; // exported symbols table | |
63 | |
64 reloc_t *incompletes; // table of incomplete references | |
65 | |
66 fileinfo_t *file; // the file we are in | |
67 } section_t; | |
68 | |
69 struct fileinfo_s | |
70 { | |
71 char *filename; | |
72 unsigned char *filedata; | |
73 long filesize; | |
74 section_t *sections; | |
75 int nsections; | |
76 | |
77 }; | |
78 | |
79 struct section_list | |
80 { | |
81 section_t *ptr; // ptr to section structure | |
82 int forceaddr; // was this force to an address by the link script? | |
83 }; | |
84 | |
85 #ifndef __link_c_seen__ | |
86 extern struct section_list *sectlist; | |
87 extern int nsects; | |
88 #endif | |
89 | |
90 | |
91 #ifndef __lwlink_c_seen__ | |
92 | |
93 extern int debug_level; | |
94 extern int outformat; | |
95 extern char *outfile; | |
96 extern int ninputfiles; | |
97 extern fileinfo_t **inputfiles; | |
98 extern char *scriptfile; | |
99 | |
100 #define __lwlink_E__ extern | |
101 #else | |
102 #define __lwlink_E__ | |
103 #endif // __lwlink_c_seen__ | |
104 | |
105 __lwlink_E__ void add_input_file(char *fn); | |
106 | |
107 #undef __lwlink_E__ | |
108 | |
109 struct scriptline_s | |
110 { | |
111 char *sectname; // name of section, NULL for wildcard | |
112 int loadat; // address to load at (or -1) | |
113 int noflags; // flags to NOT have | |
114 int yesflags; // flags to HAVE | |
115 }; | |
116 | |
117 typedef struct | |
118 { | |
119 int nlines; // number of lines in the script | |
120 struct scriptline_s *lines; // the parsed script lines (section) | |
121 int padsize; // the size to pad to, -1 for none | |
122 char *execsym; // entry point symbol | |
123 int execaddr; // execution address (entry point) | |
124 } linkscript_t; | |
125 | |
126 #ifndef __script_c_seen__ | |
127 extern linkscript_t linkscript; | |
128 #endif | |
129 | |
130 #endif //__lwlink_h_seen__ |