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

Commands Reference, Volume 5

strip Command

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.

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