Use of the Strip command

Source: Internet
Author: User
Tags uncompress
Use

Reduces the size of object files that extend the Common Object file Format (Xcoff) by dropping the information used by the binding program and the symbol debugger.

Grammar

Strip [-v] [-R [-L] |-X [-L] |-T |-H |-e |-e] [-x {|64 |32_64}] [--] File ...

Description

The Strip command reduces the size of the Xcoff object file. The strip command selectively drops line number information, relocation information, debug segments, Typchk segments, comment segments, file headers, and all or part of the symbol table from the Xcoff object file. Once you use this command, it is difficult to debug the symbol of the file, so you should usually only use the strip command on a build module that has already been debugged and tested. Use the Strip command to reduce the storage overhead required for object files.

For each object module, the strip command drops the information specified by the given option. For each archive, the strip command drops the global symbol table from the archive.

You can use the ar-s command to restore the dropped symbol table to an archive file or library file.

The strip command without options drops line number information, relocation information, symbol table, debug segment, Typchk segment, and comment segment.

Sign

-E Set the F_LOADONLY flag in the optional header of the object file. If the object file is placed in the archive, the flag tells the binding program (LD command) that the symbol in the object file should be ignored when linking to this archive.
-E Resets (closes) the f_loadonly bit in the optional header of the object file. (See the-e flag.) )
-H Drops the object file header, any optional headers, and the header portion of all segments. Note: Symbol table information is not dropped.
-L (lowercase L) to remove line number information from the object file.

-R All symbol table information is removed except for external symbols and static symbol entries. Relocation information is not dropped. The Debug and TYPCHK segments are also dropped. This option produces an object file that can still be used as input to the link editor (LD command).
-T Removes most symbol table information, but does not remove the function symbol or line number information.
-V Prints the version number of the Strip command.
-X Removes symbolic table information, but does not remove static or external symbolic information. The-x flag drops the relocation information at the same time, so it is not possible to link to the file.
-X Mode Specifies the type of object file on which the strip should be checked. Mode must be one of the following: 32 only handles 32-bit object file 64 handles only 64-bit object files 32_64 handles both 32-bit object files and 64-bit object files

The default value is to process 32-bit object files (64-bit object files are ignored). You can also use the OBJECT_MODE environment variable to set MODE. For example, object_mode=64 causes the strip to process any 64-bit object files and ignores 32-bit object files. The-X flag resets the Object_mode variable.

-- (double hyphen) interprets all parameters following the flag as the file name. This allows you to drop a file that starts with a hyphen.

Exit Status

This command returns the following exit values:

0 Successfully completed.
>0 Error.

example to drop the symbol table and line number information in the A.out file, enter:

Strip a.out
To remove an object file header from the A.out file, enter:
Strip-h a.out
To remove the 32-bit and 64-bit symbol tables in the LIB.A, enter:
Strip-x 32-64 LIB.A

file

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

==================================================================================

Weight Loss tool strip for executing files under UNIX
-

Unix File Compression command compress everyone is familiar with, its compression rate is higher, and the tar command used to do data backup is the most suitable. But compress compression also has the disadvantage, is the compressed file needs to use the command uncompress decompression before normal use. The Strip command does not have this problem, it can clear the execution of unnecessary identifiers and debugging information, can reduce file size without affecting the normal use. Unlike compress, the strip is a weight-loss tool rather than a compression tool, once the strip is not restored. Moreover, the strip after the file does not contain debugging information, you can not use DBX to debug the program.   Now let's take a look at the following program:
#include
Main ()
{
printf ("Hello, world/n");
The
is 46176 bytes long after being compiled with CC, with the strip changed to 30648, a full reduction of 1/3, and can still be performed normally. In addition to using the strip, shared libraries are also a way to reduce the length of execution files.   
Note:
1. If the file size does not decrease, it is already strip.
2.cc compile-time with the "-S" parameter, has the same effect.
Some kind of space-saving approach:
That is, you can write a zexec script for a single, larger executable. The following script is for/USR/BIN/CC
Uncompress./cc. Z
MV cc/tmp
cd/tmp
./cc

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.