STRIP(1) STRIP(1)
strip - remove symbols and relocation bits
strip [ -b -f -h -u -l -ooutfile -r -s -S -V -x ] name ...
The strip command removes the symbol table (the section named ".symtab",
Elf section kind SHT_SYMTAB) and relocation bits ordinarily attached to
the output of the assembler and loader. This is useful to save space
after a program has been debugged.
Unless option -f is given, only objects marked with ELF type ET_EXEC (the
type given to main programs) are stripped. See /usr/include/elf.h for
the type codes.
The effect of the default strip is similar to use of the -s option of ld.
Strip recognizes the following options:
-b Same effect as the default behavior. This option, though
accepted, is obsolete.
-f Allows stripping information from any ELF file (including
relocatable object files and Dynamic Shared Objects) and any
ELF file inside an archive.
-h Removes symbol names from SHT_DYNSYM and/or SHT_SYMTAB section
symbol entries marked STO_HIDDEN or STO_INTERNAL. Makes
strings in certain string tables into all zeros. (Symbols may
be marked STO_HIDDEN or STO_INTERNAL by the ld(1) options
-hidden_symbol or -hides_file.) This option saves no space in
the object, so there is no point to using it on most ELF files.
-l Strips line number information only from -n32 or -64 object
files. Doesn't strip the ELF symbol table or debugging
information other than the line number information. Does
nothing on -32 object files.
-o outfile
Specifies a name for the output file. It is a mistake to
specify more than one name to strip, since only one stripped
outputfile is created if -o outfile is specified. The output
file is created with mode 0644.
-u When combined with -o, the new output file has the current user
ID and group ID. By default (without -u) -o applies the user
ID and group ID of the input file to the output file. Ignored
if -o not supplied.
Page 1
STRIP(1) STRIP(1)
-r Same effect as the default behavior. This option, though
accepted, is obsolete.
-s Strips some sections beyond the default strippable set.
pixie,cord, and some other object tools cannot be used on a dso
or a.out with these additional sections stripped. This is
intended for standalone programs (for which the space savings
is more important than the ability to use object tools on the
resulting file).
-k When used with -s this adds the .debug_frame section to the
list of sections stripped. This option is not relevant for
old-32bit ABI objects. When used without -s the -k option does
nothing at all. If the .debug_frame section (which only
appears in n32 and 64 ABI objects) is stripped from an
executable or DSO or object then C++ exception handling may
silently work incorrectly. It is extremely unwise to use -k on
any DSO (though if the DSO is never in use with C++ exceptions
there is no harm in removing .debug_frame, how can one be sure
that the DSO won't be used with C++ exceptions?). Use -k on an
executable only if a) space saving on disk is of paramount
importance and b) you know that no C++ exceptions can occur in
the application (and preferably none can occur in any DSO it
calls (directly or indirectly)).
-S Suppress all messages (run silently).
-V Prints, on stderr, the version number of strip.
-x Turns off stripping the ELF ".symtab" (SHT_SYMTAB) symbol table
section from the object.
strp1xxxxx
strp2xxxxx
/usr/tmp/strp1xxxxx
/usr/tmp/strp2xxxxx
where xxxxx is a suffix created by tempnam(3S).
ld(1), pixie(1), tempnam(3S), cord(1)
strip returns 0 to the environment if there are no errors. In case of
any error, a non-zero value is returned to the environment with exit (3).
The -b and -r options have no effect other than printing a warning.
These options will be removed in a future release.
Page 2
STRIP(1) STRIP(1)
Temporary files are created during execution. Up to three times the space
of each original file being stripped may be needed while the program is
in operation. Temporary files may be created in /usr/tmp and in the
directory given on the command line (if no directory is specified in the
file pathname the current directory is assumed). If the command is strip
/a/b/c then the directory /a/b must have permissions to allow file
creation, writing, and reading. Whether /a/b/c is a file (with or
without multiple links) or a symbolic link to a file, the directory /a/b
must allow file creation, writing, and reading. If /a/b/c is a symbolic
link then the true directory of the real file (which could be on a
different machine or filesystem than /a/b) must also allow file creation,
writing, and reading.
The -s option removes the line-table section removed by the -l option so
using both is just like using the -s option without using the -l option.
PPPPaaaaggggeeee 3333 [ Back ]
|