Creating and Filling Holes
7-62
The following example uses assignment statements to create holes in output
sections:
SECTIONS
{
outsect:
{
file1.obj(.text)
. += 100h; /* Create a hole with size 100h
word
s */
file2.obj(.text)
. = align(16); /* Create a hole to align the SPC */
file3.obj(.text)
}
}
The output section outsect is built as follows:
-
The .text section from file1.obj is linked in.
-
The linker creates a 256-word hole.
-
The .text section from file2.obj is linked in after the hole.
-
The linker creates another hole by aligning the SPC on a 16-word
boundary.
-
Finally, the .text section from file3.obj is linked in.
All values assigned to the “ . ” symbol within a section refer to the
relative
address within the section. The linker handles assignments to the “ . ” symbol
as if the section started at address 0 (even if you have specified a binding
address). Consider the statement . = align(16) in the example. This statement
effectively aligns file3.obj .text to start on a 16-word boundary within outsect.
If outsect is ultimately allocated to start on an address that is not aligned,
file3.obj .text will not be aligned either.
Note that the “.” symbol refers to the current run address, not the current load
address, of the section.
Expressions that decrement “.” are illegal. For example, it is invalid to use the
– = operator in an assignment to “.”. The most common operators used in
assignments to “.” are += and align.
If an output section contains all input sections of a certain type (such as .text),
you can use the following statements to create a hole at the beginning or end
of the output section:
.text: { .+= 100h; } /* Hole at the beginning */
.data: {
*(.data)
. += 100h; } /* Hole at the end */
Summary of Contents for TMS320C54x
Page 38: ......
Page 39: ......
Page 40: ......
Page 41: ......
Page 42: ......
Page 43: ......
Page 44: ......
Page 45: ......
Page 46: ......
Page 47: ......
Page 48: ......
Page 49: ......
Page 50: ......
Page 51: ......
Page 52: ......
Page 53: ......
Page 54: ......
Page 55: ......
Page 56: ......
Page 57: ......
Page 58: ......
Page 59: ......
Page 60: ......
Page 61: ......
Page 62: ......
Page 276: ......
Page 277: ......
Page 278: ......
Page 279: ......
Page 280: ......
Page 281: ......
Page 282: ......
Page 283: ......
Page 284: ......
Page 285: ......
Page 286: ......
Page 287: ......
Page 288: ......
Page 289: ......
Page 290: ......
Page 291: ......
Page 292: ......
Page 293: ......
Page 294: ......
Page 295: ......
Page 296: ......
Page 297: ......
Page 298: ......
Page 299: ......
Page 300: ......
Page 301: ......
Page 302: ......