comparison docs/manual/x916.html @ 478:a71206ed966c lwtools-4.16

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