SPNU118Z September 1995 – March 2023 66AK2E05 , 66AK2H06 , 66AK2H12 , 66AK2H14 , AM1705 , AM1707 , AM1802 , AM1806 , AM1808 , AM1810 , AM5K2E04 , OMAP-L132 , OMAP-L137 , OMAP-L138 , SM470R1B1M-HT , TMS470R1A288 , TMS470R1A384 , TMS470R1A64 , TMS470R1B1M , TMS470R1B512 , TMS470R1B768
When --unused_section_elimination is on, the ELF linker does not include a section in the final link if it is not needed in the executable to resolve references. The --retain option tells the linker to retain a list of sections that would otherwise not be retained. This option accepts the wildcards '*' and '?'. When wildcards are used, the argument should be in quotes. The syntax for this option is:
--retain=sym_or_scn_spec
The --retain option take one of the following forms:
Specifying the symbol format retains sections that define symbol_spec. For example, this code retains sections that define symbols that start with init:
--retain='init*'
You cannot specify --retain='*'.
Specifying the file format retains sections that match one or more scn_spec from files matching the file_spec. For example, this code retains .intvec sections from all input files:
--retain='*(.int*)'
You can specify --retain='*(*)' to retain all sections from all input files. However, this does not prevent sections from library members from being optimized out.
Specifying the archive format retains sections matching one or more scn_spec from members matching one or more mem_spec from archive files matching ar_spec. For example, this code retains the .text sections from printf.c.obj in the rts32eabi.lib library:
--retain=rts32eabi.lib<printf.c.obj>(.text)
If the library is specified with the --library option (--library=rts32eabi.lib) the library search path is used to search for the library. You cannot specify '*<*>(*)'.