Crop the size of the executable program strip

Source: Internet
Author: User

Strip deletes information about the debugging connection table generated by-G.
For executable files, after the Strip command is used,
The size is only 1/9 of the original size
Strip command

The strip command removes the symbol table sht_symtab and its associated string table, debugging information, and line number information from elf object files. That is, besides the symbol table and associated string table, the following
Sections are removed:
. Line
. Debug *
. Stab *

This command deletes the sht_symtab, line number information, debugging information, and string table from the executable file, dynamic link library, and other binary file elf object files;
Once the command is successfully executed, GDB will not be able to read the symbol tables of these files, so it will not be able to perform normal debugging;

1. The following is a change in the debugging information of the executable file ismg_logserver_sol10_gcc34_v500_090320 before and after the Strip command is executed:
Debug with GDB before Strip:
-Bash-3.00 $ GDB
Gnu gdb 6.2.1
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
Welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "sparc-sun-solaris2.10 ".
(GDB) file ismg_logserver_sol10_gcc34_v500_090320
Reading symbols from/export/home1/ismg/ismg5/bin/ismg_logserver_sol10_gcc34_v500_090320... done.
(GDB)

Run the Strip command:
Strip ismg_logserver_sol10_gcc34_v500_090320

After the string, use the gdb tool for debugging:
-Bash-3.00 $ GDB
Gnu gdb 6.2.1
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
Welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "sparc-sun-solaris2.10 ".
(GDB) file ismg_logserver_sol10_gcc34_v500_090320
Reading symbols from/export/home1/ismg/ismg5/bin/ismg_logserver_sol10_gcc34_v500_090320... (no debugging symbols found.
(GDB)

2. The following is a change in the file size before and after the Strip command is executed on the executable file ismg_logserver_sol10_gcc34_v500_090320:
File size before Strip:
-Bash-3.00 $ LS-lt | grep logserver
-Rwxr-XR-x 1 ismg DBA 436944 March 20 ismg_logserver_sol10_gcc34_v500_090320

Run the Strip command:
Strip ismg_logserver_sol10_gcc34_v500_090320

The file size after Strip:
-Bash-3.00 $ LS-lt | grep logserver
-Rwxr-XR-x 1 ismg DBA 71116 March 20 ismg_logserver_sol10_gcc34_v500_090320

Related Article

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.