1elf32_getehdr(3ELF)          ELF Library Functions         elf32_getehdr(3ELF)
2
3
4

NAME

6       elf32_getehdr,  elf32_newehdr,  elf64_getehdr, elf64_newehdr - retrieve
7       class-dependent object file header
8

SYNOPSIS

10       cc [ flag ... ] file ... -lelf [ library ... ]
11       #include <libelf.h>
12
13       Elf32_Ehdr *elf32_getehdr(Elf *elf);
14
15
16       Elf32_Ehdr *elf32_newehdr(Elf *elf);
17
18
19       Elf64_Ehdr *elf64_getehdr(Elf *elf);
20
21
22       Elf64_Ehdr *elf64_newehdr(Elf *elf);
23
24

DESCRIPTION

26       For a 32-bit class file, elf32_getehdr() returns a pointer  to  an  ELF
27       header,  if  one  is available for the ELF descriptor elf. If no header
28       exists for the descriptor, elf32_newehdr() allocates a clean  one,  but
29       it  otherwise behaves the same as elf32_getehdr(). It does not allocate
30       a new header if one exists already. If no header exists for elf32_gete‐
31       hdr(),  one  cannot  be  created  for  elf32_newehdr(),  a system error
32       occurs, the file is not a 32-bit class file, or elf is NULL, both func‐
33       tions return a null pointer.
34
35
36       For the 64−bit class, replace 32 with 64 as appropriate.
37
38
39       The header includes the following members:
40
41         unsigned char  e_ident[EI_NIDENT];
42         Elf32_Half     e_type;
43         Elf32_Half     e_machine;
44         Elf32_Word     e_version;
45         Elf32_Addr     e_entry;
46         Elf32_Off      e_phoff;
47         Elf32_Off      e_shoff;
48         Elf32_Word     e_flags;
49         Elf32_Half     e_ehsize;
50         Elf32_Half     e_phentsize;
51         Elf32_Half     e_phnum;
52         Elf32_Half     e_shentsize;
53         Elf32_Half     e_shnum;
54         Elf32_Half     e_shstrndx;
55
56
57
58       The  elf32_newehdr()  function  automatically sets the ELF_F_DIRTY bit.
59       See elf_flagdata(3ELF).
60
61
62       An application can use elf_getident()  to  inspect  the  identification
63       bytes from a file.
64
65
66       An  application  can use elf_getshnum() and elf_getshstrndx() to obtain
67       section header information. The location of this section header  infor‐
68       mation  differs  between  standard  ELF  files  to  those  that require
69       Extended Sections.
70

ATTRIBUTES

72       See attributes(5) for descriptions of the following attributes:
73
74
75
76
77       ┌─────────────────────────────┬─────────────────────────────┐
78       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
79       ├─────────────────────────────┼─────────────────────────────┤
80       │Interface Stability          │Stable                       │
81       ├─────────────────────────────┼─────────────────────────────┤
82       │MT-Level                     │MT-Safe                      │
83       └─────────────────────────────┴─────────────────────────────┘
84

SEE ALSO

86       elf(3ELF),  elf_begin(3ELF),  elf_flagdata(3ELF),   elf_getident(3ELF),
87       elf_getshnum(3ELF), elf_getshstrndx(3ELF), libelf(3LIB), attributes(5)
88
89
90
91SunOS 5.11                        19 Jun 2002              elf32_getehdr(3ELF)
Impressum