annotate docs/manual/x762.html @ 194:f8b33b3a45ac

Fix noexpand macro listings to show all bytes output Fix stupid error when checking for more than 8 bytes for a given source line so it checks the correct byte length instead of just checking the length of the current line's output.
author William Astle <lost@l-w.ca>
date Wed, 25 Jan 2012 22:39:17 -0700
parents 1e0a0e6cd918
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
168
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
2 <HTML
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
3 ><HEAD
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
4 ><TITLE
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
5 >Linker Operation</TITLE
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
6 ><META
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
7 NAME="GENERATOR"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
8 CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
9 REL="HOME"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
10 TITLE="LW Tool Chain"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
11 HREF="index.html"><LINK
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
12 REL="UP"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
13 TITLE="LWLINK"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
14 HREF="c662.html"><LINK
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
15 REL="PREVIOUS"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
16 TITLE="LWLINK"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
17 HREF="c662.html"><LINK
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
18 REL="NEXT"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
19 TITLE="Linking Scripts"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
20 HREF="x776.html"></HEAD
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
21 ><BODY
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
22 CLASS="SECTION"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
23 BGCOLOR="#FFFFFF"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
24 TEXT="#000000"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
25 LINK="#0000FF"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
26 VLINK="#840084"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
27 ALINK="#0000FF"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
28 ><DIV
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
29 CLASS="NAVHEADER"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
30 ><TABLE
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
31 SUMMARY="Header navigation table"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
32 WIDTH="100%"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
33 BORDER="0"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
34 CELLPADDING="0"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
35 CELLSPACING="0"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
36 ><TR
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
37 ><TH
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
38 COLSPAN="3"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
39 ALIGN="center"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
40 >LW Tool Chain</TH
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
41 ></TR
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
42 ><TR
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
43 ><TD
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
44 WIDTH="10%"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
45 ALIGN="left"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
46 VALIGN="bottom"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
47 ><A
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
48 HREF="c662.html"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
49 ACCESSKEY="P"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
50 >Prev</A
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
51 ></TD
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
52 ><TD
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
53 WIDTH="80%"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
54 ALIGN="center"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
55 VALIGN="bottom"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
56 >Chapter 4. LWLINK</TD
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
57 ><TD
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
58 WIDTH="10%"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
59 ALIGN="right"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
60 VALIGN="bottom"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
61 ><A
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
62 HREF="x776.html"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
63 ACCESSKEY="N"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
64 >Next</A
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
65 ></TD
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
66 ></TR
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
67 ></TABLE
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
68 ><HR
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
69 ALIGN="LEFT"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
70 WIDTH="100%"></DIV
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
71 ><DIV
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
72 CLASS="SECTION"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
73 ><H1
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
74 CLASS="SECTION"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
75 ><A
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
76 NAME="AEN762"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
77 >4.2. Linker Operation</A
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
78 ></H1
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
79 ><P
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
80 >&#13;LWLINK takes one or more files in supported input formats and links them
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
81 into a single binary. Currently supported formats are the LWTOOLS object
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
82 file format and the archive format used by LWAR. While the precise method is
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
83 slightly different, linking can be conceptualized as the following steps.&#13;</P
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
84 ><P
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
85 ></P
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
86 ><OL
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
87 TYPE="1"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
88 ><LI
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
89 ><P
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
90 >First, the linker loads a linking script. If no script is specified, it
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
91 loads a built-in default script based on the output format selected. This
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
92 script tells the linker how to lay out the various sections in the final
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
93 binary.</P
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
94 ></LI
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
95 ><LI
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
96 ><P
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
97 >Next, the linker reads all the input files into memory. At this time, it
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
98 flags any format errors in those files. It constructs a table of symbols
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
99 for each object at this time.</P
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
100 ></LI
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
101 ><LI
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
102 ><P
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
103 >The linker then proceeds with organizing the sections loaded from each file
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
104 according to the linking script. As it does so, it is able to assign addresses
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
105 to each symbol defined in each object file. At this time, the linker may
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
106 also collapse different instances of the same section name into a single
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
107 section by appending the data from each subsequent instance of the section
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
108 to the first instance of the section.</P
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
109 ></LI
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
110 ><LI
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
111 ><P
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
112 >Next, the linker looks through every object file for every incomplete reference.
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
113 It then attempts to fully resolve that reference. If it cannot do so, it
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
114 throws an error. Once a reference is resolved, the value is placed into
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
115 the binary code at the specified section. It should be noted that an
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
116 incomplete reference can reference either a symbol internal to the object
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
117 file or an external symbol which is in the export list of another object
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
118 file.</P
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
119 ></LI
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
120 ><LI
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
121 ><P
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
122 >If all of the above steps are successful, the linker opens the output file
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
123 and actually constructs the binary.</P
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
124 ></LI
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
125 ></OL
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
126 ></DIV
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
127 ><DIV
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
128 CLASS="NAVFOOTER"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
129 ><HR
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
130 ALIGN="LEFT"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
131 WIDTH="100%"><TABLE
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
132 SUMMARY="Footer navigation table"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
133 WIDTH="100%"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
134 BORDER="0"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
135 CELLPADDING="0"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
136 CELLSPACING="0"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
137 ><TR
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
138 ><TD
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
139 WIDTH="33%"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
140 ALIGN="left"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
141 VALIGN="top"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
142 ><A
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
143 HREF="c662.html"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
144 ACCESSKEY="P"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
145 >Prev</A
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
146 ></TD
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
147 ><TD
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
148 WIDTH="34%"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
149 ALIGN="center"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
150 VALIGN="top"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
151 ><A
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
152 HREF="index.html"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
153 ACCESSKEY="H"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
154 >Home</A
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
155 ></TD
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
156 ><TD
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
157 WIDTH="33%"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
158 ALIGN="right"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
159 VALIGN="top"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
160 ><A
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
161 HREF="x776.html"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
162 ACCESSKEY="N"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
163 >Next</A
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
164 ></TD
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
165 ></TR
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
166 ><TR
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
167 ><TD
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
168 WIDTH="33%"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
169 ALIGN="left"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
170 VALIGN="top"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
171 >LWLINK</TD
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
172 ><TD
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
173 WIDTH="34%"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
174 ALIGN="center"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
175 VALIGN="top"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
176 ><A
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
177 HREF="c662.html"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
178 ACCESSKEY="U"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
179 >Up</A
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
180 ></TD
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
181 ><TD
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
182 WIDTH="33%"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
183 ALIGN="right"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
184 VALIGN="top"
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
185 >Linking Scripts</TD
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
186 ></TR
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
187 ></TABLE
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
188 ></DIV
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
189 ></BODY
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
190 ></HTML
1e0a0e6cd918 Documentation updates
lost@l-w.ca
parents:
diff changeset
191 >