elf_compress(3elf) 맨 페이지 - 윈디하나의 솔라나라

개요

섹션
맨 페이지 이름
검색(S)

elf_compress(3elf)

elf_compress(3ELF)           ELF Library Functions          elf_compress(3ELF)

NAME
       elf_compress, elf_compress_gnu - compress/decompress section data

SYNOPSIS
       cc [ flag ... ] file ... -lelf [ library ... ]
       #include <libelf.h>

       int elf_compress(Elf_Scn *scn, uint_t type, uint_t flags);


       int elf_compress_gnu(Elf_Scn *scn, int inflate, uint_t flags);

DESCRIPTION
       elf_compress()  is  used to compress or decompress an ELF section using
       the standard ELF  ABI compression format. The type  argument  specifies
       the desired compression type, and can be one of the following.

       0

           Decompress any compressed content.


       ELF_COMPRESS_ZLIB

           ZLIB compression.


       ELF_COMPRESS_ZSTD

           ZStandard (ZSTD) compression.



       elf_compress_gnu() is used to compress or decompress an ELF section us‐
       ing  the original GNU compression format. inflate is set to 1 to decom‐
       press, and 0 to compress.


       The flags argument is used to specify compression  options.  The  flags
       argument can be 0, or can be set to the following value.

       ELF_CHF_FORCE

           In  rare cases, compression algorithms can produce data larger than
           the original uncompressed data. The default  behavior  of  elf_com‐
           press() and elf_compress_gnu() are to compress a given section only
           if  the  resulting section is reduced in size. Set ELF_CHF_FORCE to
           require that the section always be compressed.


RETURN VALUES
       If an error occurs, elf_compress() and elf_compress_gnu() return -1 and
       set elf_errno().


       If the section was not compressed because the resulting data  would  be
       larger than the original, 0 is returned and the section is unaltered.


       If  the section is successfully compressed, elf_compress() and elf_com‐
       press_gnu() update the section header, and the original data associated
       with the section is replaced. Any information previously  returned  for
       the  section by elf32_getshdr(), elf64_shdr(), or elf_getdata(), is in‐
       validated, and should no longer be referenced by the caller. The caller
       should defer calling those functions until after calling elf_compress()
       or elf_compress_gnu(), or should call them again afterward in order  to
       obtain the new information.

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

       tab()  box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) ATTRIBUTE TYPEAT‐
       TRIBUTE VALUE _ Interface StabilityCommitted _ MT-LevelMT-Safe


SEE ALSO
       elf(3ELF),          elf32_getchdr(3ELF),           elf32_getshdr(3ELF),
       elf32_xlatetof(3ELF),     elf64_getchdr(3ELF),     elf64_getshdr(3ELF),
       elf64_xlatetof(3ELF),  elf_errno(3ELF),  elf_flagshdr(3ELF),   elf_get‐
       data(3ELF),  elf_getscn(3ELF),  elf_update(3ELF), libelf(3LIB), attrib‐
       utes(7)


       https://zlib.net/


       https://facebook.github.io/zstd/zstd_manual.html

NOTES
       elf_compress() and elf_compress_gnu() do not set the  ELF_F_DIRTY  flag
       for  the section. The caller must explicitly call elf_flagshdr() in or‐
       der to keep the changes when elf_update() is used.


       elf_compress() and elf_compress_gnu() will reject a compression attempt
       for a section that is already compressed. The caller must first  decom‐
       press the section, and then compress it into the desired format.


       elf_compress()  and  elf_compress_gnu() will reject a decompression at‐
       tempt for a section that is already uncompressed.


       The original GNU compression format is  deprecated.  elf_compress_gnu()
       is  provided  in order to support existing objects. The use of elf_com‐
       press() when creating new objects is recommended. The original GNU com‐
       pression format can only be applied to sections with names  that  start
       with  .debug. On compression, that type requires the name to be altered
       to start with .zdebug. elf_compress_gnu() does not provide the replace‐
       ment name. The caller is  responsible  for  providing  the  replacement
       name.

Oracle Solaris 11.4            2 September 2025             elf_compress(3ELF)
맨 페이지 내용의 저작권은 맨 페이지 작성자에게 있습니다.
RSS ATOM XHTML 5 CSS3