Assigning Symbols at Link Time
7-58
7.14.2 Assigning the SPC to a Symbol
A special symbol, denoted by a dot ( . ), represents the current value of the SPC
during allocation. The linker’s “.” symbol is analogous to the assembler’s $
symbol. The “.” symbol can be used only in assignment statements within a
SECTIONS directive because “.” is meaningful only during allocation, and
SECTIONS controls the allocation process.
The “.” symbol refers to the current run address, not the current load address,
of the section.
For example, suppose a program needs to know the address of the beginning
of the .data section. By using the .global directive, you can create an external
undefined variable called Dstart in the program. Then assign the value of “ . ”
to Dstart:
SECTIONS
{
.text: {}
.data: { Dstart = .; }
.bss: {}
}
This defines Dstart to be the first linked address of the .data section. (Dstart
is assigned
before .data is allocated.) The linker will relocate all references to
Dstart.
A special type of assignment assigns a value to the “.” symbol. This adjusts
the SPC within an output section and creates a hole between two input sec-
tions. Any value assigned to “.” to create a hole is relative to the beginning of
the section, not to the address actually represented by “.”. Assignments to “.”
and holes are described in Section 7.15,
Creating and Filling Holes, on page
7-61.
7.14.3 Assignment Expressions
These rules apply to linker expressions:
-
Expressions can contain global symbols, constants, and the C language
operators listed in Table 7–1.
-
All numbers are treated as long (32-bit) integers.
-
Constants are identified by the linker in the same way as by the assembler.
That is, numbers are recognized as decimal unless they have a suffix (H
or h for hexadecimal and Q or q for octal). C language prefixes are also
recognized (0 for octal and 0x for hex). Hexadecimal constants must begin
with a digit. No binary constants are allowed.
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: ......