Go to main content

man pages section 1: User Commands

Exit Print View

Updated: Thursday, June 13, 2019
 
 

elfcompress (1)

Name

elfcompress - compress/decompress debug sections of an object file

Synopsis

elfcompress [-fV] [-n name] [-t type] file...

Description

The elfcompress command is used to compress or decompress debug sections in ELF object files. Unless otherwise specified, all debug and annotate sections are manipulated.

If the input file is an archive (see ar.h(3HEAD)), the archive is treated as a set of individual files. If the archive member is not an object file, then it is left unchanged.

elfcompress cannot modify a section that is contained within a segment. Such allocable sections have their SHF_ALLOC section flag set. elfcompress cannot modify sections of type SHT_NOBITS. The compression operation specified with the–t option may place additional limits on candidate sections. See the –t option, and NOTES.

When the –n option is used to specify one or more sections to process, only the specified sections are processed, and all other sections are left unmodified. When the –n option is not used, elfcompress selects all sections that are compatible with the compression operation specified with the –t option.

Options

The following options are supported:

–f

By default, elfcompress will only compress sections if their resulting size is equal to or smaller than the original data. Specify –f to force compression even when the resulting size is larger than the original.

–n name

Specifies the name of the section to process. elfcompress can take multiple –n options to allow for specification of multiple sections. If –n is not used, elfcompress selects all debug sections that are compatible with the specified compression operation. See the –t option, and NOTES.

–t type

Specifies the compression operation to be performed. The following compression types are recognized.

none

Compressed sections are decompressed.

zlib

Compress debug sections with ZLIB compression. Candidate sections must be non-allocable (SHF_ALLOC flag not set) and have a section type of SHT_PROGBITS, SHT_SUNW_DEBUG, SHT_SUNW_DEBUGSTR, or SHT_SUNW_ANNOTATE . The resulting sections will have the SHF_COMPRESSED section flag set to identify the use of compression.

zlib-gnu

Compress debug sections with ZLIB compression, using the GNU section compression format. Candidate sections must be non-allocable (SHF_ALLOC flag not set), cannot have type SHT_NOBITS, and must have a name that begins with .debug. The resulting section will be renamed to start with .zdebug, to identify the use of compression.

If the –t option is not specified, the effect is equivalent to specifying –t zlib.

–V
–-version

Print version information.

–?
–-help

Print usage message and immediately exit.

Notes

The zlib-gnu compression format is limited to sections with names that start with .debug, while the default zlib compression format can be applied to sections with arbitrary names. When –t zlib-gnu is specified, and the –n option is not, any previously compressed sections with names that are incompatible with the zlib-gnu format are decompressed.

The elfcompress command is unable to modify core files.

Examples

Example 1 Apply zlib compression to all debug sections
% elfcompress file
Example 2 Decompress all debug sections
% elfcompress -t none file
Example 3 Compress the .debug_info section, using the GNU-style format
% elfcompress -t zlib-gnu -n .debug_info file

Files

/tmp/elfcompress*

temporary files

Attributes

See attributes(7) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Availability
developer/base-developer-utilities
Interface Stability
Committed

See Also

ar(1), as(1), ld(1), mcs(1), strip(1), elf(3ELF), ar.h(3HEAD), zlib(3), a.out(5), attributes(7)

Oracle Solaris 11.4 Linkers and Libraries Guide