Mercurial > hg-old > index.cgi
comparison doc/manual/c558.html @ 153:ffef3ea07399 2.1 2.1
Preparing for release
author | lost |
---|---|
date | Fri, 30 Jan 2009 04:32:55 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
152:6bd4755d224f | 153:ffef3ea07399 |
---|---|
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"> | |
2 <HTML | |
3 ><HEAD | |
4 ><TITLE | |
5 >Object Files</TITLE | |
6 ><META | |
7 NAME="GENERATOR" | |
8 CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK | |
9 REL="HOME" | |
10 TITLE="LW Tool Chain" | |
11 HREF="index.html"><LINK | |
12 REL="PREVIOUS" | |
13 TITLE="Linking Scripts" | |
14 HREF="x524.html"></HEAD | |
15 ><BODY | |
16 CLASS="CHAPTER" | |
17 BGCOLOR="#FFFFFF" | |
18 TEXT="#000000" | |
19 LINK="#0000FF" | |
20 VLINK="#840084" | |
21 ALINK="#0000FF" | |
22 ><DIV | |
23 CLASS="NAVHEADER" | |
24 ><TABLE | |
25 SUMMARY="Header navigation table" | |
26 WIDTH="100%" | |
27 BORDER="0" | |
28 CELLPADDING="0" | |
29 CELLSPACING="0" | |
30 ><TR | |
31 ><TH | |
32 COLSPAN="3" | |
33 ALIGN="center" | |
34 >LW Tool Chain</TH | |
35 ></TR | |
36 ><TR | |
37 ><TD | |
38 WIDTH="10%" | |
39 ALIGN="left" | |
40 VALIGN="bottom" | |
41 ><A | |
42 HREF="x524.html" | |
43 ACCESSKEY="P" | |
44 >Prev</A | |
45 ></TD | |
46 ><TD | |
47 WIDTH="80%" | |
48 ALIGN="center" | |
49 VALIGN="bottom" | |
50 ></TD | |
51 ><TD | |
52 WIDTH="10%" | |
53 ALIGN="right" | |
54 VALIGN="bottom" | |
55 > </TD | |
56 ></TR | |
57 ></TABLE | |
58 ><HR | |
59 ALIGN="LEFT" | |
60 WIDTH="100%"></DIV | |
61 ><DIV | |
62 CLASS="CHAPTER" | |
63 ><H1 | |
64 ><A | |
65 NAME="OBJCHAP" | |
66 ></A | |
67 >Chapter 5. Object Files</H1 | |
68 ><P | |
69 >LWTOOLS uses a proprietary object file format. It is proprietary in the sense | |
70 that it is specific to LWTOOLS, not that it is a hidden format. It would be | |
71 hard to keep it hidden in an open source tool chain anyway. This chapter | |
72 documents the object file format.</P | |
73 ><P | |
74 >An object file consists of a series of sections each of which contains a | |
75 list of exported symbols, a list of incomplete references, and a list of | |
76 "local" symbols which may be used in calculating incomplete references. Each | |
77 section will obviously also contain the object code.</P | |
78 ><P | |
79 >Exported symbols must be completely resolved to an address within the | |
80 section it is exported from. That is, an exported symbol must be a constant | |
81 rather than defined in terms of other symbols.</P | |
82 ><P | |
83 >Each object file starts with a magic number and version number. The magic | |
84 number is the string "LWOBJ16" for this 16 bit object file format. The only | |
85 defined version number is currently 0. Thus, the first 8 bytes of the object | |
86 file are <FONT | |
87 COLOR="RED" | |
88 >4C574F424A313600</FONT | |
89 ></P | |
90 ><P | |
91 >Each section has the following items in order:</P | |
92 ><P | |
93 ></P | |
94 ><UL | |
95 ><LI | |
96 ><P | |
97 >section name</P | |
98 ></LI | |
99 ><LI | |
100 ><P | |
101 >flags</P | |
102 ></LI | |
103 ><LI | |
104 ><P | |
105 >list of local symbols (and addresses within the section)</P | |
106 ></LI | |
107 ><LI | |
108 ><P | |
109 >list of exported symbols (and addresses within the section)</P | |
110 ></LI | |
111 ><LI | |
112 ><P | |
113 >list of incomplete references along with the expressions to calculate them</P | |
114 ></LI | |
115 ><LI | |
116 ><P | |
117 >the actual object code (for non-BSS sections)</P | |
118 ></LI | |
119 ></UL | |
120 ><P | |
121 >The section starts with the name of the section with a NUL termination | |
122 followed by a series of flag bytes terminated by NUL. There are only two | |
123 flag bytes defined. A NUL (0) indicates no more flags and a value of 1 | |
124 indicates the section is a BSS section. For a BSS section, no actual | |
125 code is included in the object file.</P | |
126 ><P | |
127 >Either a NULL section name or end of file indicate the presence of no more | |
128 sections.</P | |
129 ><P | |
130 >Each entry in the exported and local symbols table consists of the symbol | |
131 (NUL terminated) followed by two bytes which contain the value in big endian | |
132 order. The end of a symbol table is indicated by a NULL symbol name.</P | |
133 ><P | |
134 >Each entry in the incomplete references table consists of an expression | |
135 followed by a 16 bit offset where the reference goes. Expressions are | |
136 defined as a series of terms up to an "end of expression" term. Each term | |
137 consists of a single byte which identifies the type of term (see below) | |
138 followed by any data required by the term. Then end of the list is flagged | |
139 by a NULL expression (only an end of expression term).</P | |
140 ><DIV | |
141 CLASS="TABLE" | |
142 ><A | |
143 NAME="AEN583" | |
144 ></A | |
145 ><P | |
146 ><B | |
147 >Table 5-1. Object File Term Types</B | |
148 ></P | |
149 ><TABLE | |
150 BORDER="1" | |
151 FRAME="border" | |
152 CLASS="CALSTABLE" | |
153 ><COL><COL><THEAD | |
154 ><TR | |
155 ><TH | |
156 >TERMTYPE</TH | |
157 ><TH | |
158 >Meaning</TH | |
159 ></TR | |
160 ></THEAD | |
161 ><TBODY | |
162 ><TR | |
163 ><TD | |
164 >00</TD | |
165 ><TD | |
166 >end of expression</TD | |
167 ></TR | |
168 ><TR | |
169 ><TD | |
170 >01</TD | |
171 ><TD | |
172 >integer (16 bit in big endian order follows)</TD | |
173 ></TR | |
174 ><TR | |
175 ><TD | |
176 >02</TD | |
177 ><TD | |
178 > external symbol reference (NUL terminated symbol name follows)</TD | |
179 ></TR | |
180 ><TR | |
181 ><TD | |
182 >03</TD | |
183 ><TD | |
184 >local symbol reference (NUL terminated symbol name follows)</TD | |
185 ></TR | |
186 ><TR | |
187 ><TD | |
188 >04</TD | |
189 ><TD | |
190 >operator (1 byte operator number)</TD | |
191 ></TR | |
192 ><TR | |
193 ><TD | |
194 >05</TD | |
195 ><TD | |
196 >section base address reference</TD | |
197 ></TR | |
198 ></TBODY | |
199 ></TABLE | |
200 ></DIV | |
201 ><P | |
202 >External references are resolved using other object files while local | |
203 references are resolved using the local symbol table(s) from this file. This | |
204 allows local symbols that are not exported to have the same names as | |
205 exported symbols or external references.</P | |
206 ><DIV | |
207 CLASS="TABLE" | |
208 ><A | |
209 NAME="AEN610" | |
210 ></A | |
211 ><P | |
212 ><B | |
213 >Table 5-2. Object File Operator Numbers</B | |
214 ></P | |
215 ><TABLE | |
216 BORDER="1" | |
217 FRAME="border" | |
218 CLASS="CALSTABLE" | |
219 ><COL><COL><THEAD | |
220 ><TR | |
221 ><TH | |
222 >Number</TH | |
223 ><TH | |
224 >Operator</TH | |
225 ></TR | |
226 ></THEAD | |
227 ><TBODY | |
228 ><TR | |
229 ><TD | |
230 >01</TD | |
231 ><TD | |
232 >addition (+)</TD | |
233 ></TR | |
234 ><TR | |
235 ><TD | |
236 >02</TD | |
237 ><TD | |
238 >subtraction (-)</TD | |
239 ></TR | |
240 ><TR | |
241 ><TD | |
242 >03</TD | |
243 ><TD | |
244 >multiplication (*)</TD | |
245 ></TR | |
246 ><TR | |
247 ><TD | |
248 >04</TD | |
249 ><TD | |
250 >division (/)</TD | |
251 ></TR | |
252 ><TR | |
253 ><TD | |
254 >05</TD | |
255 ><TD | |
256 >modulus (%)</TD | |
257 ></TR | |
258 ><TR | |
259 ><TD | |
260 >06</TD | |
261 ><TD | |
262 >integer division (\) (same as division)</TD | |
263 ></TR | |
264 ><TR | |
265 ><TD | |
266 >07</TD | |
267 ><TD | |
268 >bitwise and</TD | |
269 ></TR | |
270 ><TR | |
271 ><TD | |
272 >08</TD | |
273 ><TD | |
274 >bitwise or</TD | |
275 ></TR | |
276 ><TR | |
277 ><TD | |
278 >09</TD | |
279 ><TD | |
280 >bitwise xor</TD | |
281 ></TR | |
282 ><TR | |
283 ><TD | |
284 >0A</TD | |
285 ><TD | |
286 >boolean and</TD | |
287 ></TR | |
288 ><TR | |
289 ><TD | |
290 >0B</TD | |
291 ><TD | |
292 >boolean or</TD | |
293 ></TR | |
294 ><TR | |
295 ><TD | |
296 >0C</TD | |
297 ><TD | |
298 >unary negation, 2's complement (-)</TD | |
299 ></TR | |
300 ><TR | |
301 ><TD | |
302 >0D</TD | |
303 ><TD | |
304 >unary 1's complement (^)</TD | |
305 ></TR | |
306 ></TBODY | |
307 ></TABLE | |
308 ></DIV | |
309 ><P | |
310 >An expression is represented in a postfix manner with both operands for | |
311 binary operators preceding the operator and the single operand for unary | |
312 operators preceding the operator.</P | |
313 ></DIV | |
314 ><DIV | |
315 CLASS="NAVFOOTER" | |
316 ><HR | |
317 ALIGN="LEFT" | |
318 WIDTH="100%"><TABLE | |
319 SUMMARY="Footer navigation table" | |
320 WIDTH="100%" | |
321 BORDER="0" | |
322 CELLPADDING="0" | |
323 CELLSPACING="0" | |
324 ><TR | |
325 ><TD | |
326 WIDTH="33%" | |
327 ALIGN="left" | |
328 VALIGN="top" | |
329 ><A | |
330 HREF="x524.html" | |
331 ACCESSKEY="P" | |
332 >Prev</A | |
333 ></TD | |
334 ><TD | |
335 WIDTH="34%" | |
336 ALIGN="center" | |
337 VALIGN="top" | |
338 ><A | |
339 HREF="index.html" | |
340 ACCESSKEY="H" | |
341 >Home</A | |
342 ></TD | |
343 ><TD | |
344 WIDTH="33%" | |
345 ALIGN="right" | |
346 VALIGN="top" | |
347 > </TD | |
348 ></TR | |
349 ><TR | |
350 ><TD | |
351 WIDTH="33%" | |
352 ALIGN="left" | |
353 VALIGN="top" | |
354 >Linking Scripts</TD | |
355 ><TD | |
356 WIDTH="34%" | |
357 ALIGN="center" | |
358 VALIGN="top" | |
359 > </TD | |
360 ><TD | |
361 WIDTH="33%" | |
362 ALIGN="right" | |
363 VALIGN="top" | |
364 > </TD | |
365 ></TR | |
366 ></TABLE | |
367 ></DIV | |
368 ></BODY | |
369 ></HTML | |
370 > |