Reduces the size of an Extended Common Object File Format (XCOFF) object file by removing information used by the binder and symbolic debug program.
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.
Item | Description |
---|---|
-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. |
Item | Description |
---|---|
-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:
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. |
This command returns the following exit values:
Item | Description |
---|---|
0 | Successful completion. |
>0 | An error occurred. |
strip a.out
strip -H a.out
strip -X 32_64 lib.a
Item | Description |
---|---|
/usr/ccs/bin/strip | Contains the strip command. |