[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Commands Reference, Volume 5


strip Command

The strip command includes information for strip on a POWER-based platform and an strip on an Itanium-based platform.

strip Command on POWER-based Platform

Purpose

Reduces the size of an Extended Common Object File Format (XCOFF) object file by removing information used by the binder and symbolic debug program.

Syntax

strip [ -V] [  -r -l ] |  -x -l ] |  -t -H -e -E ] [  -X  {32|64|32_64}]-- ]  File ...

Description

The strip command reduces the size of XCOFF object files. The strip command optionally removes the line number information, relocation information, the debug section, the typchk section, the comment section, file headers, and all or part of the symbol table from the XCOFF object files. Once you use this command, symbolic debugging of the file is difficult; therefore, you should normally use the strip command only on production modules that you have debugged and tested. Using the strip command reduces the storage overhead required by an object file.

For each object module, the strip command removes information as specified by the supplied options. For each archive file, the strip command removes the global symbol table from the archive.

You can restore a stripped symbol table to an archive or library file by using the ar -s command.

The strip command with no options removes the line number information, relocation information, symbol table, the debug section, and the typchk section, and the comment section.

Flags


-e Sets the F_LOADONLY flag in the optional header of the object file. If the object file is placed in an archive, this flag indicates to the binder (ld command) that symbols in the object file should be ignored when linking with the archive.
-E Resets (turns off) the F_LOADONLY bit in the optional header of the object file. (See -e flag).
-H Removes the object file header, any optional header, and all section headers.

Note: Symbol Table information is not removed.
-l (Lowercase L) Strips the line number information from the object file.


-r Removes all symbol table information except those entries for external and static symbols. Does not remove the relocation information. Also removes the debug and typchk sections. This option produces an object file that can still be used as input to the linkage editor (ld command).
-t Removes most symbol table information but does not remove function symbols or line number information.
-V Prints the version number of the strip command.
-x Removes the symbol table information but does not remove static or external symbol information. The -x flag also removes relocation information, therefore linking to the file would not be possible.
-X mode Specifies the type of object file strip should examine. The mode must be one of the following:

32
Processes only 32-bit object files

64
Processes only 64-bit object files

32_64
Processes both 32-bit and 64-bit object files

The default is to process 32-bit object files (ignore 64-bit objects). The mode can also be set with the OBJECT_MODE environment variable. For example, OBJECT_MODE=64 causes strip to process any 64-bit objects and ignore 32-bit objects. The -X flag overrides the OBJECT_MODE variable.

-- (Double hyphen) Interprets all arguments following this flag as file names. This allows you to strip files whose names start with a hyphen.

Exit Status

This command returns the following exit values:

0 Successful completion.
>0 An error occurred.

Examples

  1. To remove the symbol table and line number information from the a.out file, enter:

    strip a.out
    
  2. To remove the object file header of the a.out file, enter:

    strip -H a.out
    
  3. To remove both the 32-bit and 64-bit symbol tables from lib.a, enter:

    strip -X 32-64 lib.a
    

Files


/usr/ccs/bin/strip Contains the strip command.

Related Information

The ar command, as command, dump command, ld command, size command.

The ar file, a.out file.

strip Command on Itanium-based Platform

Purpose

Strip symbol table, debugging and line number information from an object file.

Syntax

strip [-lVx] file . . .

Description

The strip command strips the symbol table, debugging information, and line number information from ELF object files. Once this stripping process has been done, no symbolic debugging access will be available for that file; therefore, this command is normally run only on production modules that have been debugged and tested.

If strip is executed on a common archive file (see ar file format) in addition to processing the members, strip will remove the archive symbol table. The archive symbol table must be restored by executing the ar command with the -s flag before the archive can be linked by the ld command. strip will produce appropriate warning messages when this situation arises.

The amount of information stripped from the ELF object file can be controlled by using any of the following options:

-l
Strip line number information only; do not strip the symbol table or debugging information.

-V
Print, on standard error, the version number of strip.

-x
Do not strip the symbol table; debugging and line number information may be stripped.

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

Files


TMPDIR/strp*
temporary files


TMPDIR
usually /var/tmp but can be redefined by setting the environment variable TMPDIR

Related Information

The a.out file format, ar file format.

The ar command, as command, dump command, and ld command.

The tmpnam subroutine.

Notices

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.

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.


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]