DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

strip(CP)


strip -- strip symbol and line number information from an object file

Syntax

strip [-b format ] [-b] [-l] [-r] [-V] [-x] filename ...

Description

The strip(CP) command strips the symbol table and line number information from object files, including archives. Once that has been done, symbolic debugging can not be done on a file; therefore, this command is normally run only on production modules that have been debugged and tested.

strip can manipulate both ELF and COFF files. strip scans each input file to determine its file format and executes the appropriate strip binary. The file format of the first module in an archive library is used as the file format for all modules in that library. Use option -b format to force strip to use a particular file format.


-b format
Do not scan input object files. Use format as the file format for all files. format can be any one of elf, coff, and ibcs2. The case of format is not important.

-b coff
Invoke /usr/ccs/bin/coff/strip and treat all file arguments as COFF files. This option provides full backward compatibility.


CAUTION: strip fails if any file or module in a file is in ELF format.


-b elf
Invoke /usr/ccs/bin/elf/strip and treat all file arguments as ELF files.


CAUTION: strip fails if any file or module in a file is in COFF format.


-b ibcs2
Invoke /usr/ccs/bin/coff/strip to treat all file arguments as COFF files.

The amount of information stripped from the symbol table can be controlled by using any of the following options:


-b
If filename is a COFF file, then same as the -x option, but do not strip scoping information (for example, beginning and end of block delimiters). If filename is an ELF file, then -b without a specified format is recognized but ignored.


CAUTION: Option -b with no format specified is different from option -b format.


-l
Strip line number information only; do not strip any symbol table information.

-r
Do not strip static or external symbol information, or relocation information.

-V
Print the version of the strip command executing on the standard error output.

-x
Do not strip static or external symbol information; debugging and line number information may be stripped.

If there are any relocation entries in the object file and any symbol table information is to be stripped, strip complains and terminates without stripping filename, unless the -r option is used.

If the strip command is executed on a common archive file (see ar(FP)) the archive symbol table is removed. You can restore the archive symbol table by executing the ar(CP) command with the -s option. This must be done before the archive can be link-edited by the ld(CP) command. strip produces warning messages when this situation arises.

The strip command is used to reduce the file storage overhead taken by the object file.

Diagnostics


strip: name: cannot open

name cannot be read.

strip: name: bad magic

name is not an appropriate object file.

strip: name: relocation entries present; cannot strip
name contains relocation entries and the -r flag is not used, the symbol table information cannot be stripped.

Warning

strip determines whether an object file is in ELF or COFF format and executes the appropriate strip binaries in each case. Since it relies on the files in /usr/ccs/bin/elf and /usr/ccs/bin/coff, changing or moving any of those files results in an error.

For ELF files the symbol table section will not be removed if it is contained within a segment, or the file is either a relocatable or dynamic shared object.

For ELF files the line number and debugging sections will not be removed if they are contained within a segment, or their associated relocation section is contained within a segment.

Files


TMPDIR/strp*
Temporary files. TMPDIR is usually /usr/tmp but can be re-defined by setting the environment variable TMPDIR (see tempnam(S) in tmpnam(S)).

See also

a.out(FP), ar(CP), ar(FP) as(CP), cc(CP), ld(CP), tmpnam(S)

Standards conformance

strip is conformant with:

X/Open Portability Guide, Issue 3, 1989 .


© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003