Strip command usage

Source: Internet
Author: User
Tags uncompress
ArticleDirectory
    •  
    • Syntax
    • Description
    • Flag
    • Exit status
    • Example
    •  

Original article link

Remove bindingProgramAnd the information used by the symbolic debugging program to reduce the size of the object file in the extended public object file format (xcoff.

Syntax

Strip[-V] [-R [-L] |-X [-L] |-T |-H |-E] [-X{32|64|32_64}] [--]File...

Description

StripCommand to reduce the size of the xcoff object file.StripCommands can selectively remove line number information, relocation information, debugging segments, typchk segments, comment segments, file headers, and all or part of symbol tables from xcoff object files. Once you use this command, it is difficult to debug the symbols of the file. Therefore, it is generally only used on the Generation modules that have been debugged and tested.StripCommand. UseStripCommand to reduce the storage overhead required for object files.

For each object module,StripCommand to remove the information specified by the given options. For each archive file,StripCommand to remove the global symbol table from the archive.

AvailableAr-SCommand to restore the removed symbol table to an archive or library file.

No optionStripCommand to remove line number information, relocation information, symbol table, debugging segment, typchk segment and Comment Segment.

Flag

-E Set in the optional Header of the Object FileF_loadonlyFlag. If the object file is placed in the archive, this flag notifies the binding Program (LDCommand), the symbols in the object file should be ignored during the link to this archive.
-E In the optional Header of the reset (close) object fileF_loadonlyBit. (See-EFlag .)
-H Remove the object file header, any optional headers, And the headers of all segments.

Note:Do not remove the symbol table information.

-L (Lower case l) removes the row number information from the object file.

 

-R Except external and static symbol entries, all symbol table information is removed. The relocation information is not excluded. Besides the debugging and typchk segments. This option generates an object file, which can still be used as input to the link Editor (LDCommand.
-T Except most symbol table information, function symbols or row number information are not excluded.
-V PrintStripCommand version.
-X Except the symbol table information, static or external symbol information is not removed.-XMark removes the relocation information at the same time, so it is impossible to link to the file.
-X Mode Specified checkStripObject file type.ModeMust be one of the following:
32
Only 32-bit object files are processed
64
Only 64-bit object files are processed
32_64
Processing both 32-bit object files and 64-bit object files

The default value is to process 32-bit object files (ignore 64-bit object files ). You can also useObject_modeSet Environment VariablesMode. For example,Object_mode = 64EnableStripProcess any 64-bit object file and ignore the 32-bit object file.-XFlag resettingObject_modeVariable.

-- (Dual-concatenation) All parameters following the flag are interpreted as file names. This allows you to remove files whose names start with a hyphen.

Exit status

This command returns the following exit value:

0 Completed successfully.
> 0 Error.

Example
    1. To removeA. OutEnter the symbol table and row number information in the file:

      Strip A. Out
    2. To removeA. OutObject File Header, enter:
      Strip-h a. Out
    3. To removeLib.In the 32-bit and 64-bit symbol tables, enter:
      Strip-x 32-64 Lib.

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

Strip
-

the compress command for File compression in UNIX is familiar to everyone. It has a high compression ratio. It is best to use it with the tar command for data backup. However, compress compression also has a disadvantage, that is, the compressed file must be decompressed with the uncompress command before it can be used properly. The strip command does not solve this problem. It can clear unnecessary identifiers and debugging information in the execution file and reduce the file size without affecting normal use. Different from compress, strip cannot be restored once files are strip, so strip is a weight loss tool rather than a compression tool. Besides, if the Strip file does not contain debugging information, DBX cannot be used to debug the program. Now let's take a look at the specific effect. See the following program:
# include
main ()
{< br> printf ("hello, world/N ");
}< br> after compiling with CC, the length is 46176 bytes. After using strip, it is changed to 30648, which is reduced by 1/3 and can still be executed normally. In addition to strip, shared libraries are also used to reduce the execution file length.
Note:
1. if the file size is not reduced, strip has passed.
adding the "-s" parameter to 2.cc compilation has the same effect.
some space saving method:
A zexec script can be written for a single large executable file. the following script is only 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.