Mercurial > hg > index.cgi
comparison docs/manual/x841.html @ 333:507f442dc71e
Add support for 6800 compatibility instructions.
The occasional program uses the 6800 compatibility instructions since they
are actually specified by Motorola in at least some documentation. They
advertised the 6809 as source compatible with the 6800.
This mode is not enabled by default, however. It is my belief that receiving
an error when using a non-6809 instruction is more useful since it is
unlikely that much 6800 source code is being assembled for the 6809 these
days. Nevertheless, the --6809compat option is present for just those
purposes so one does not have to resort to using macros (which would work
equally well in most cases).
author | William Astle <lost@l-w.ca> |
---|---|
date | Tue, 15 Apr 2014 10:57:34 -0600 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
332:26bfe8d557e2 | 333:507f442dc71e |
---|---|
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 >Linking Scripts</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="c727.html"><LINK | |
15 REL="PREVIOUS" | |
16 TITLE="Linker Operation" | |
17 HREF="x827.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="Format Specific Linking Notes" | |
20 HREF="x907.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="x827.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="x907.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="AEN841" | |
77 >4.3. Linking Scripts</A | |
78 ></H1 | |
79 ><P | |
80 >A linker script is used to instruct the linker about how to assemble the | |
81 various sections into a completed binary. It consists of a series of | |
82 directives which are considered in the order they are encountered.</P | |
83 ><P | |
84 >The sections will appear in the resulting binary in the order they are | |
85 specified in the script file. If a referenced section is not found, the linker will behave as though the | |
86 section did exist but had a zero size, no relocations, and no exports. | |
87 A section should only be referenced once. Any subsequent references will have | |
88 an undefined effect.</P | |
89 ><P | |
90 >All numbers are in linking scripts are specified in hexadecimal. All directives | |
91 are case sensitive although the hexadecimal numbers are not.</P | |
92 ><P | |
93 >A section name can be specified as a "*", then any section not | |
94 already matched by the script will be matched. The "*" can be followed | |
95 by a comma and a flag to narrow the section down slightly, also. | |
96 If the flag is "!bss", then any section that is not flagged as a bss section | |
97 will be matched. If the flag is "bss", then any section that is flagged as | |
98 bss will be matched.</P | |
99 ><P | |
100 >The following directives are understood in a linker script.</P | |
101 ><P | |
102 ></P | |
103 ><DIV | |
104 CLASS="VARIABLELIST" | |
105 ><DL | |
106 ><DT | |
107 >sectopt <CODE | |
108 CLASS="PARAMETER" | |
109 >section</CODE | |
110 > padafter <CODE | |
111 CLASS="PARAMETER" | |
112 >byte,...</CODE | |
113 ></DT | |
114 ><DD | |
115 ><P | |
116 > This will cause the linker to append the specified list of byte values | |
117 (specified in hexadecimal separated by commas) to the end of the named | |
118 section. This is done once all instances of the specified section are | |
119 collected together. This has no effect if the specified section does not | |
120 appear anywhere in any of the objects specified for linking. </P | |
121 ><P | |
122 > If code depends on the presence of this padding somewhere, it is sufficient | |
123 to include an empty section of the specified name in the object that depends | |
124 on it. </P | |
125 ></DD | |
126 ><DT | |
127 >define basesympat <CODE | |
128 CLASS="PARAMETER" | |
129 >string</CODE | |
130 ></DT | |
131 ><DD | |
132 ><P | |
133 > This causes the linker to define a symbol for the ultimate base address of | |
134 each section using the pattern specified by <CODE | |
135 CLASS="PARAMETER" | |
136 >string</CODE | |
137 >. | |
138 In the string, %s can appear exactly once and will be replaced with the | |
139 section name. The base address is calculated after all instances of each | |
140 section have been collapsed together. </P | |
141 ><P | |
142 > It should be noted that if none of the objects to be linked contains a | |
143 particular section name, there will be no base symbol defined for it, even | |
144 if it is listed explicitly in the link script. If code depends on the | |
145 presence of these symbols, it is sufficient to include an empty section of | |
146 the specified name in the object that depends on it. </P | |
147 ><P | |
148 > If the pattern resolves to the same string for multiple | |
149 sections, the results are undefined. </P | |
150 ></DD | |
151 ><DT | |
152 >define lensympat <CODE | |
153 CLASS="PARAMETER" | |
154 >string</CODE | |
155 ></DT | |
156 ><DD | |
157 ><P | |
158 > This causes the linker to define a symbol for the ultimate length of each | |
159 section using the pattern specified by <CODE | |
160 CLASS="PARAMETER" | |
161 >string</CODE | |
162 >. In | |
163 the string, %s can appear exactly once and will be replaced with the section | |
164 name. The length is calculated after all instances of a section have been | |
165 collapsed together. </P | |
166 ><P | |
167 > It should be noted that if none of the objects to be linked contains a | |
168 particular section name, there will be no length symbol defined for it, even | |
169 if it is listed explicitly in the link script. If code depends on the | |
170 presence of these symbols, it is sufficient to include an empty section of | |
171 the specified name in the object that depends on it. </P | |
172 ><P | |
173 >If the pattern resolves to the same string for multiple | |
174 sections, the results are undefined. </P | |
175 ></DD | |
176 ><DT | |
177 >section <CODE | |
178 CLASS="PARAMETER" | |
179 >name</CODE | |
180 > load <CODE | |
181 CLASS="PARAMETER" | |
182 >addr</CODE | |
183 ></DT | |
184 ><DD | |
185 ><P | |
186 > This causes the section <CODE | |
187 CLASS="PARAMETER" | |
188 >name</CODE | |
189 > to load at | |
190 <CODE | |
191 CLASS="PARAMETER" | |
192 >addr</CODE | |
193 >. For the raw target, only one "load at" entry is | |
194 allowed for non-bss sections and it must be the first one. For raw targets, | |
195 it affects the addresses the linker assigns to symbols but has no other | |
196 affect on the output. bss sections may all have separate load addresses but | |
197 since they will not appear in the binary anyway, this is okay.</P | |
198 ><P | |
199 >For the decb target, each "load" entry will cause a new "block" to be | |
200 output to the binary which will contain the load address. It is legal for | |
201 sections to overlap in this manner - the linker assumes the loader will sort | |
202 everything out.</P | |
203 ></DD | |
204 ><DT | |
205 >section <CODE | |
206 CLASS="PARAMETER" | |
207 >name</CODE | |
208 > high <CODE | |
209 CLASS="PARAMETER" | |
210 >addr</CODE | |
211 ></DT | |
212 ><DD | |
213 ><P | |
214 > This causes the section <CODE | |
215 CLASS="PARAMETER" | |
216 >name</CODE | |
217 > to load with its end | |
218 address just below <CODE | |
219 CLASS="PARAMETER" | |
220 >addr</CODE | |
221 >. Subsequent sections are | |
222 loaded at progressively lower addresses. This may lead to inefficient file | |
223 encoding for some targets. As of this writing, it will also almost | |
224 certainly do the wrong thing for a raw target. </P | |
225 ><P | |
226 > This is useful for aligning a block of code with high memory. As an | |
227 example, if the total size of a section is $100 bytes and a high address of | |
228 $FE00 is specified, the section will actually load at $FD00. </P | |
229 ></DD | |
230 ><DT | |
231 >section <CODE | |
232 CLASS="PARAMETER" | |
233 >name</CODE | |
234 ></DT | |
235 ><DD | |
236 ><P | |
237 > This will cause the section <CODE | |
238 CLASS="PARAMETER" | |
239 >name</CODE | |
240 > to load after the previously listed | |
241 section.</P | |
242 ></DD | |
243 ><DT | |
244 >entry <CODE | |
245 CLASS="PARAMETER" | |
246 >addr or sym</CODE | |
247 ></DT | |
248 ><DD | |
249 ><P | |
250 >This will cause the execution address (entry point) to be the address | |
251 specified (in hex) or the specified symbol name. The symbol name must | |
252 match a symbol that is exported by one of the object files being linked. | |
253 This has no effect for targets that do not encode the entry point into the | |
254 resulting file. If not specified, the entry point is assumed to be address 0 | |
255 which is probably not what you want. The default link scripts for targets | |
256 that support this directive automatically starts at the beginning of the | |
257 first section (usually "init" or "code") that is emitted in the binary.</P | |
258 ></DD | |
259 ><DT | |
260 >pad <CODE | |
261 CLASS="PARAMETER" | |
262 >size</CODE | |
263 ></DT | |
264 ><DD | |
265 ><P | |
266 >This will cause the output file to be padded with NUL bytes to be exactly | |
267 <CODE | |
268 CLASS="PARAMETER" | |
269 >size</CODE | |
270 > bytes in length. This only makes sense for a raw target.</P | |
271 ></DD | |
272 ></DL | |
273 ></DIV | |
274 ></DIV | |
275 ><DIV | |
276 CLASS="NAVFOOTER" | |
277 ><HR | |
278 ALIGN="LEFT" | |
279 WIDTH="100%"><TABLE | |
280 SUMMARY="Footer navigation table" | |
281 WIDTH="100%" | |
282 BORDER="0" | |
283 CELLPADDING="0" | |
284 CELLSPACING="0" | |
285 ><TR | |
286 ><TD | |
287 WIDTH="33%" | |
288 ALIGN="left" | |
289 VALIGN="top" | |
290 ><A | |
291 HREF="x827.html" | |
292 ACCESSKEY="P" | |
293 >Prev</A | |
294 ></TD | |
295 ><TD | |
296 WIDTH="34%" | |
297 ALIGN="center" | |
298 VALIGN="top" | |
299 ><A | |
300 HREF="index.html" | |
301 ACCESSKEY="H" | |
302 >Home</A | |
303 ></TD | |
304 ><TD | |
305 WIDTH="33%" | |
306 ALIGN="right" | |
307 VALIGN="top" | |
308 ><A | |
309 HREF="x907.html" | |
310 ACCESSKEY="N" | |
311 >Next</A | |
312 ></TD | |
313 ></TR | |
314 ><TR | |
315 ><TD | |
316 WIDTH="33%" | |
317 ALIGN="left" | |
318 VALIGN="top" | |
319 >Linker Operation</TD | |
320 ><TD | |
321 WIDTH="34%" | |
322 ALIGN="center" | |
323 VALIGN="top" | |
324 ><A | |
325 HREF="c727.html" | |
326 ACCESSKEY="U" | |
327 >Up</A | |
328 ></TD | |
329 ><TD | |
330 WIDTH="33%" | |
331 ALIGN="right" | |
332 VALIGN="top" | |
333 >Format Specific Linking Notes</TD | |
334 ></TR | |
335 ></TABLE | |
336 ></DIV | |
337 ></BODY | |
338 ></HTML | |
339 > |