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

개요

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

elf_getident(3elf)

elf_getident(3ELF)           ELF Library Functions          elf_getident(3ELF)

NAME
       elf_getident,    elf_getphdrnum,   elf_getshdrnum,   elf_getshdrstrndx,
       elf_getphnum, elf_getshnum, elf_getshstrndx - retrieve ELF header data

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

       char *elf_getident(Elf *elf, size_t *dst);


       int elf_getphdrnum(Elf *elf, size_t *dst);


       int elf_getshdrnum(Elf *elf, size_t *dst);


       int elf_getshdrstrndx(Elf *elf, size_t *dst);

   Obsolete Interfaces
       int elf_getphnum(Elf *elf, size_t *dst);


       int elf_getshnum(Elf *elf, size_t *dst);


       int elf_getshstrndx(Elf *elf, size_t *dst);

DESCRIPTION
       As elf(3ELF) explains, ELF provides a framework for various classes  of
       files,  where  basic  objects  might have 32 or 64 bits. To accommodate
       these differences, without forcing the  larger  sizes  on  smaller  ma‐
       chines,  the  initial bytes in an ELF file hold identification informa‐
       tion common to all file classes. The e_ident of every  ELF  header  has
       EI_NIDENT bytes with interpretations described in the following table.

       tab(); lw(1.83i) lw(1.83i) lw(1.83i) e_ident IndexValuePurpose

       EI_MAG0ELFMAG0File    identification    EI_MAG1ELFMAG1   EI_MAG2ELFMAG2
       EI_MAG3ELFMAG3

       EI_CLASSELFCLASSNONEFile class ELFCLASS32 ELFCLASS64

       EI_DATAELFDATANONEData encoding ELFDATA2LSB ELFDATA2MSB

       EI_VERSIONEV_CURRENTFile version

       7-150Unused, set to zero



       Other kinds of files might have identification data, though they  would
       not  conform  to  e_ident.  See elf_kind(3ELF) for information on other
       kinds of files.


       The elf_getident() function returns a pointer to the initial  bytes  of
       the  file.  If  the  library recognizes the file, a conversion from the
       file image to the memory image can occur. The identification bytes  are
       guaranteed to be unmodified, though the size of the unmodified area de‐
       pends  on  the  file type. If the dst argument is non-null, the library
       stores the number of identification bytes in the location to which  dst
       points.  If  no  data are present, elf is NULL, or an error occurs, the
       return value is a null pointer, with 0 stored through dst,  if  dst  is
       non-null.


       The  elf_getphdrnum()  function  obtains  the number of program headers
       recorded in the ELF file. The number of sections in a file is typically
       recorded in the e_phnum field of the ELF header. A file  that  requires
       the  ELF extended program header records the value PN_XNUM in the e_ph‐
       num field and records the number of sections in the  sh_info  field  of
       section  header  0.  See USAGE. The dst argument points to the location
       where the number of sections is stored. If elf is NULL or an error  oc‐
       curs, elf_getphdrnum() returns −1.


       The  elf_getshdrnum()  function obtains the number of sections recorded
       in the ELF file. The number of sections in a file is typically recorded
       in the e_shnum field of the ELF header. A file that  requires  ELF  ex‐
       tended section records the value 0 in the e_shnum field and records the
       number of sections in the sh_size field of section header 0. See USAGE.
       The dst argument points to the location where the number of sections is
       stored. If a call to elf_newscn(3ELF) that uses the same elf descriptor
       is  performed, the value obtained by elf_getshnum() is valid only after
       a successful call to elf_update(3ELF). If elf is NULL or an  error  oc‐
       curs, elf_getshdrnum() returns −1.


       The  elf_getshdrstrndx()  function  obtains  the  section  index of the
       string table associated with the section headers in the ELF  file.  The
       section  header  string  table  index  is  typically  recorded  in  the
       e_shstrndx field of the ELF header. A file that requires  ELF  extended
       section  records  the  value  SHN_XINDEX  in  the  e_shstrndx field and
       records the string table index in the sh_link field of  section  header
       0. See USAGE. The dst argument points to the location where the section
       header string table index is stored. If elf is NULL or an error occurs,
       elf_getshdrstrndx() returns −1.


       The elf_getphnum(), elf_getshnum(), and elf_getshstrndx() functions be‐
       have  in  a  manner  similar to elf_getphdrnum(), elf_getshdrnum(), and
       elf_getshdrstrndx(), respectively, except that they return 0 if elf  is
       NULL  or an error occurs. Because these return values differ from those
       used by some other systems, they are therefore non-portable  and  their
       use   is   discouraged.  The  elf_getphdrnum(),  elf_getshdrnum(),  and
       elf_getshdrstrndx() functions should be used instead.

USAGE
       ELF extended sections allow an ELF file to  contain  more  than  0xff00
       (SHN_LORESERVE) section. ELF extended program headers allow an ELF file
       to contain 0xffff (PN_XNUM) or more program headers. See the Oracle So‐
       laris 11.4 Linkers and Libraries Guide for more information.

RETURN VALUES
       Upon  successful  completion,  the  elf_getident()  function  returns a
       pointer to the initial bytes of the file. Otherwise, it return 0.


       Upon successful completion, the elf_getphdrnum(), elf_getshdrnum(), and
       elf_getshdrstrndx() functions return 0. Otherwise, they return -1.


       Upon successful completion,  the  elf_getphnum(),  elf_getshnum(),  and
       elf_getshstrndx() functions return 1. Otherwise, they return 0.

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 StabilitySee below.  _ MT-LevelMT-Safe



       The elf_getident(), elf_getphdrnum(),  elf_getshdrnum(),  and  elf_get‐
       shdrstrndx()  functions  are  Committed.  The  elf_getphnum(), elf_get‐
       shnum(), and elf_getshstrndx() functions are Committed (Obsolete).

SEE ALSO
       elf_kind(3ELF),   elf(3ELF),   elf32_getehdr(3ELF),    elf_begin(3ELF),
       elf_newscn(3ELF),  elf_rawfile(3ELF),  elf_update(3ELF),  libelf(3LIB),
       attributes(7)


       Oracle Solaris 11.4 Linkers and Libraries Guide

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