| |||
| Home > Linker command-line options > --keep=section_id | |||
This option specifies input sections that must not be removed by unused section elimination.
--keep=section_id
Where is
one of the following: section_id
symbolSpecifies that an input section defining is
to be retained during unused section elimination. If multiple definitions
of symbol exist, armlink generates
an error message. symbol
For example, you might use --keep=int_handler.
To keep all sections that define a symbol ending in _handler,
use --keep=*_handler.
object(section)Specifies that from section is
to be retained during unused section elimination. If a single instance
of object is generated,
you can omit section,
for example, sectionfile.o(). Otherwise, you must specify .section
For example, to keep the vect section from
the vectors.o object use: --keep=vectors.o(vect)
To keep all sections from the vectors.o object
where the first three characters of the name of the sections are vec,
use:--keep=vectors.o(vec*)
objectSpecifies that the single input section from is
to be retained during unused section elimination. If you use this
short form and there is more than one input section in object,
the linker generates an error message.object
For example, you might use --keep=dspdata.o.
To keep the single input section from each of the objects
that has a name starting with dsp, use --keep=dsp*.o.
All forms of the argument
can contain the section_id* and ? wild
characters. Matching is case-insensitive, even on hosts with case-sensitive
file naming. For example:
--keep foo.o(Premier*) causes the entire
match for Premier* to be case-insensitive
--keep foo.o(Premier) causes
a case-sensitive match for the string Premier.
Use *.o to match all object files. Use * to
match all object files and libraries.
You can specify multiple --keep options on
the command line.
If you name a symbol with the same name as an object, then --keep= searches
for a symbol that matches symbol_id:symbol_id
If a symbol is found, it matches the symbol.
If no symbol is found, it matches the object.
You can force --keep to match an object with --keep=.
Therefore, to keep both the symbol and the object, specify symbol_id()--keep
foo.o --keep foo.o().
Using the Linker: