2.1.74. --keep=section_id
section_id
This option specifies input sections that must not be removed by unused section elimination.
--keep=section_id
Where section_id
is one of the following:
-
Specifies that an input section defining
is to be retained during unused section elimination. If multiple definitions ofsymbol
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
. -
Specifies that
fromsection
is to be retained during unused section elimination. For example, to keep theobject
vect
section from thevectors.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 section arevec
, use:--keep=vectors.o(vec*)
-
Specifies 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 inobject
, 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
.
symbol
object
(section
)
object
All forms of the section_id
argument can contain the *
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 forPremier*
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 matchessymbol_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, specifysymbol_id
()--keep foo.o --keep foo.o()
.