User`s guide
ELF Linker and Command Language
Structure of Linker Command Files
289Targeting MC56F83xx/DSP5685x Controllers
NOTE The closure blocks need to be in place before the SECTIONS
definition in the linker command file.
The two types of closure blocks available are:
• Symbol-level
Use FORCE_ACTIVE to include a symbol into the link that would not be
otherwise included. An example is shown in Listing 10.2
.
Listing 10.2 Sample Symbol-level Closure Block
FORCE_ACTIVE {break_handler, interrupt_handler, my_function}
• Section-level
Use KEEP_SECTION when you want to keep a section (usually a user-defined
section) in the link. Listing 10.3
shows an example.
Listing 10.3 Sample Section-level Closure Block
KEEP_SECTION {.interrupt1, .interrupt2}
A variant is REF_INCLUDE. It keeps a section in the link, but only if the file where it
is coming from is referenced. This is very useful to include version numbers. Listing
10.4 shows an example of this.
Listing 10.4 Sample Section-level Closure Block With File Dependency
REF_INCLUDE {.version}
Sections Segment
Inside the sections segment, you define the contents of your memory segments, and
define any global symbols to be used in the output file.
The format of a typical sections block looks like Listing 10.5
.
NOTE
As shown in Listing 10.5, the .bss section needs to go after the
.data section.