Simply put, is to strip the file took off his coat, concrete is stripped of some of the symbols and debugging information from a specific file, the file smaller.
We can enter the man strip in the shell of the strip to get some relevant information
STRIP(1) GNU Development Tools STRIP(1)
NAME
strip - Discard symbols from object files.
SYNOPSIS
strip [-F bfdname |--target=bfdname]
[-I bfdname |--input-target=bfdname]
[-O bfdname |--output-target=bfdname]
[-s|--strip-all]
[-S|-g|-d|--strip-debug]
[--strip-dwo]
[-K symbolname |--keep-symbol=symbolname]
[-N symbolname |--strip-symbol=symbolname]
[-w|--wildcard]
[-x|--discard-all] [-X |--discard-locals]
[-R sectionname |--remove-section=sectionname]
[-o file] [-p|--preserve-dates]
[-D|--enable-deterministic-archives]
[-U|--disable-deterministic-archives]
[--keep-file-symbols]
[--only-keep-debug]
[-v |--verbose] [-V|--version]
[--help] [--info]
objfile...
DESCRIPTION
GNU strip discards all symbols from object files objfile. The list of
object files may include archives. At least one object file must be
given.
strip modifies the files named in its argument, rather than writing
modified copies under different names.
XCOFF order to reduce the size of the strip (Common Object File Format) object files. strip command is selectively removed from the object file XCOFF line number information, relocation information, the debug section, the typchk section, the comment section, all or part of the file header and the symbol table. Save a lot of space. Especially for the embedded space, it is quite important.
We can use the file command to view a file, as follows:
Before slimming size 2856byte, a full space-saving nearly twice! Removing the cost of the line number information, relocation information, the debug section, the typchk section, the comment section, all or part of the file header and the symbol table. Unable to debug and positioning
Run command to weight loss, which is an embedded strip into my arm-linux-gnueabihf-strip
arm-linux-gnueabihf-strip dump_test
File size 5984byte
strip not only can, but also in the actual development, often we need to be targeted against executable files and dynamic libraries on the dynamic library .so strip operations, reduce floor space. And when debugging (such as using addr2line), you need to sign up. Therefore, the usual practice is: before the strip is meant for debugging, the library is used to strip the actual release, they both have a corresponding relationship. Once the strip published library is a problem, you can not find the corresponding strip of the library to locate.
The COFF Object Format is used both for object files (.o extension) and executable files.
COFF object format for both the intermediate files, executable files
Some of the information is only present in object files,
Only some of the information appears in the object file
other information is only present in the executable files.
Other information appear only in the executable file
Table G-1 COFF file components COFF files
Section section names |
Description Description |
File header Header |
Contains general information; always present. The message contains a general, always effective |
Optional header Extension Header |
Contains information about an executable file; usually only present in executables. It contains information about the executable file, usually only in the executable file |
Section header Section head |
Contains information about the different COFF sections; one for each section. Each containing a different COFF section information, each section corresponding to each section header |
Raw data sections Raw data area |
One for each section containing raw data, such as machine instructions and initialized variables. Each segment contains data, such as executable machine code, and is used to initialize variables |
Relocation information Relocation information |
Contains information about unresolved references to symbols in other modules; Symbol file contains information from the other is not determined addresses. one for each section having external references. Each segment has an external symbol Usually only present in object files and not in executable files. And not in the target file usually appears in an executable file |
Line number information Line number information |
Contains debugging information about source line numbers; Information hero debugging source code line numbers one for each section if compiled with the -g option. If the compiler option -g contain parameters, then each section contains |
Symbol table Symbol table |
Contains information about all the symbols in the object file; All symbols contain information of the target file present if not stripped from an executable file. Object files contain executable files if not removed, then there |
String table String table |
Contains long symbol names. Longer than 8 bytes contain the symbolic name |