NAME elf_zscn_identify SYNOPSIS cc [ flag ... ] file ... -lelf [ library ... ] #include int elf_zscn_identify(Elf_Scn *scn, const char *scn_name); DESCRIPTION elf_zscn_identify determines the type of compression employed by a section. scn_name is the name of the section, and is required in order to identify ELF_ZSCN_T_ZLIB_GNU type compression. It may be set to NULL by applications that do not support that type of compression. See NOTES. RETURN VALUE Upon failure, elf_zscn_identify returns -1, and sets elf_errno. See elf_errno(3ELF). Otherwise, one of the following values is returned. ELF_ZSCN_T_NONE The section is not compressed. ELF_ZSCN_T_ZLIB ZLIB compression, ELF ABI format. ELF_ZSCN_T_ZLIB_GNU ZLIB compression, in the original GNU format. See NOTES. EXAMPLES Example 1 Display section compression type The following code fragment iterates over all the sections of an ELF object, and prints the section index, name, and compression type for each compressed section. The details of obtaining the section name, error handling, and of converting the compression type to a printable string, are omitted in the interest of brevity. ndx = 1; for (scn = NULL; scn = elf_nextscn(elf, scn); ndx++) { scn_name = get_scn_name(...); ztype = elf_zscn_identify(scn, scn_name); if (ztype == -1) error(...); if (ztype != ELF_ZSCN_T_NONE) (void) printf("[%u] %s: %s\n", ndx, scn_name, ztype_to_str(ztype)); } NOTES The ELF_ZSCN_T_ZLIB_GNU compression type is deprecated, and is provided in order to support existing objects. The ELF_ZSCN_T_ZLIB type, which is not dependent on section name, is preferred. The ELF_ZSCN_T_ZLIB_GNU compression type can only be applied to sections with names that start with .debug. When compressed, the name is altered to start with .zdebug. The scn_name argument is therefore required in order to identify sections compressed in this type. If scn_name is NULL, elf_zscn_identify() will identify ELF_ZSCN_T_ZLIB_GNU sections as ELF_ZSCN_NONE. SEE ALSO elf_zscn_compress(3ELF), elf_zscn_compressible(3ELF), elf_zscn_decompress(3ELF), libelf(3LIB)