annotate doc/scripts.txt @ 305:10cc87f4b16c

Added basic raw output module
author lost
date Thu, 22 Jan 2009 02:14:52 +0000
parents 9c6462b3a288
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
295
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
1 LWLINK linker scripts
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
2
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
3 A linker script is used to instruct the linker about how to assemble the
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
4 various sections into a completed binary. It consists of a series of
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
5 directives which are considered in the order they are encountered. Any
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
6 section not referenced by a directive is assumed to be loaded after the
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
7 final section explicitly referenced.
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
8
304
9c6462b3a288 Documented the "exec" directive in linker scripts
lost
parents: 295
diff changeset
9 The sections will appear in the resulting binary in the order they are
9c6462b3a288 Documented the "exec" directive in linker scripts
lost
parents: 295
diff changeset
10 specified in the script file.
9c6462b3a288 Documented the "exec" directive in linker scripts
lost
parents: 295
diff changeset
11
9c6462b3a288 Documented the "exec" directive in linker scripts
lost
parents: 295
diff changeset
12 If a referenced section is not found, the linker will behave as though the
9c6462b3a288 Documented the "exec" directive in linker scripts
lost
parents: 295
diff changeset
13 section did exist but had a zero size, no relocations, and no exports.
9c6462b3a288 Documented the "exec" directive in linker scripts
lost
parents: 295
diff changeset
14
295
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
15 A section may only be referenced once. Any subsequent references will have
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
16 no effect.
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
17
304
9c6462b3a288 Documented the "exec" directive in linker scripts
lost
parents: 295
diff changeset
18 All numbers are hexadecimal.
9c6462b3a288 Documented the "exec" directive in linker scripts
lost
parents: 295
diff changeset
19
9c6462b3a288 Documented the "exec" directive in linker scripts
lost
parents: 295
diff changeset
20 section <name> load <addr>
295
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
21
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
22 This causes the section <name> to load at <addr>. For raw target, only one
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
23 "load at" entry is allowed for non-bss sections and it must be the first
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
24 one. For raw targets, it affects the addresses the linker assigns to symbols
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
25 but has no other affect on the output. bss sections may all have separate
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
26 load addresses but since they will not appear in the binary anyway, this is
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
27 okay.
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
28
304
9c6462b3a288 Documented the "exec" directive in linker scripts
lost
parents: 295
diff changeset
29 For the DECB target, each "load" entry will cause a new "block" to be
295
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
30 output to the binary which will contain the load address. It is legal for
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
31 sections to overlap in this manner - the linker assumes the loader will sort
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
32 everything out.
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
33
304
9c6462b3a288 Documented the "exec" directive in linker scripts
lost
parents: 295
diff changeset
34 section <name>
9c6462b3a288 Documented the "exec" directive in linker scripts
lost
parents: 295
diff changeset
35
9c6462b3a288 Documented the "exec" directive in linker scripts
lost
parents: 295
diff changeset
36 This will cause the section <name> to load after the previously listed
9c6462b3a288 Documented the "exec" directive in linker scripts
lost
parents: 295
diff changeset
37 section.
9c6462b3a288 Documented the "exec" directive in linker scripts
lost
parents: 295
diff changeset
38
9c6462b3a288 Documented the "exec" directive in linker scripts
lost
parents: 295
diff changeset
39 exec <addr or sym>
295
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
40
304
9c6462b3a288 Documented the "exec" directive in linker scripts
lost
parents: 295
diff changeset
41 This will cause the execution address (entry point) to be the address
9c6462b3a288 Documented the "exec" directive in linker scripts
lost
parents: 295
diff changeset
42 specified (in hex) *or* the specified symbol name. The symbol name must
9c6462b3a288 Documented the "exec" directive in linker scripts
lost
parents: 295
diff changeset
43 match a symbol that is exported by one of the object files being linked.
9c6462b3a288 Documented the "exec" directive in linker scripts
lost
parents: 295
diff changeset
44 This has no effect for targets that do not encode the entry point into the
9c6462b3a288 Documented the "exec" directive in linker scripts
lost
parents: 295
diff changeset
45 resulting file. If not specified, the entry point is assumed to be address 0
9c6462b3a288 Documented the "exec" directive in linker scripts
lost
parents: 295
diff changeset
46 which is probably not what you want. The default link scripts for targets
9c6462b3a288 Documented the "exec" directive in linker scripts
lost
parents: 295
diff changeset
47 that support this directive automatically starts at the beginning of the
9c6462b3a288 Documented the "exec" directive in linker scripts
lost
parents: 295
diff changeset
48 first section (usually "init" or "code") that is emitted in the binary.
295
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
49
304
9c6462b3a288 Documented the "exec" directive in linker scripts
lost
parents: 295
diff changeset
50 pad <size>
295
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
51
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
52 This will cause the output file to be padded with NUL bytes to be exactly
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
53 <size> bytes in length. This only makes sense for a raw target.
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
54
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
55
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
56 If <name> is "*", then any section not already matched by the script will be
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
57 matched. For format *,<flags> can be used to select sections which have
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
58 particular flags set (or not set). For instance:
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
59
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
60 *,!bss This would match all sections that do not have the bss flag set
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
61 *,bss this would match all sections that do have the bss flag set
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
62
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
63