The SHF_COMPRESSED section flag identifies a section containing compressed data. SHF_COMPRESSED applies only to non-allocable sections, and cannot be used in conjunction with SHF_ALLOC. In addition, SHF_COMPRESSED cannot be applied to sections of type SHT_NOBITS.
Any relocations that must be applied to a compressed section specify offsets to the uncompressed section data. It is therefore necessary to uncompress section data before relocations can be applied. Each compressed section specifies the algorithm independently. Different sections in a given ELF object can employ different compression algorithms.
Compressed sections start with a compression header structure that identifies the compression algorithm.
typedef struct { Elf32_Word ch_type; Elf32_Word ch_size; Elf32_Word ch_addralign; } Elf32_Chdr; typedef struct { Elf64_Word ch_type; Elf64_Word ch_reserved; Elf64_Xword ch_size; Elf64_Xword ch_addralign; } Elf64_Chdr;
Specifies the compression algorithm. Supported algorithms and their descriptions are listed in Figure 22, Table 22, ELF Compression Types, ch_type.
The size in bytes of the uncompressed data. See sh_size.
Required alignment for the uncompressed data. See sh_addralign.
The sh_size and sh_addralign fields of the section header for a compressed section reflect the requirements of the compressed section. The ch_size and ch_addralign fields of the compression header provide the corresponding values for the uncompressed data, thereby supplying the values that sh_size and sh_addralign would have if the section had not been compressed.
The layout and interpretation of the data that follows the compression header is specific to each algorithm. This layout may contain algorithm specific parameters and alignment padding in addition to compressed data bytes.
A compression header's ch_type member specifies the compression algorithm employed, as shown in the following table.
|
The section data is compressed with the ZLIB compression algorithm. The compressed ZLIB data bytes begin with the byte immediately following the compression header, and extend to the end of the section. Documentation for ZLIB may be found at http://www.zlib.net/.
Values in this inclusive range are reserved for operating system-specific semantics.
Values in this inclusive range are reserved for processor-specific semantics.
In addition to the compression format discussed previously, the Oracle Solaris link-editor understands an alternative format used by the GNU tool chain. This format does not employ a section flag to indicate compression. Instead, a section name that starts with the .zdebug prefix identifies a section containing compressed data. GNU-style compressed sections start with the following compression header structure.
typedef struct { uchar_t gch_magic[4]; uchar_t gch_size[8]; } Chdr_GNU;
A 4-byte magic number identifying the compression algorithm. At this time, only ZLIB compression is supported. The values of gch_magic for ZLIB compression is as listed in Figure 23, Table 23, GNU ZLIB Compression, gch_magic.
The size in bytes of the uncompressed data, encoded as a 64-bit ELFDATA2MSB big endian integer value.
|