elf32_getehdr(3E)
NAME
elf32_getehdr, elf32_newehdr − retrieve class-dependent object file header
SYNOPSIS
cc [ flag ... ] file ... −lelf [ library ... ]
#include <libelf.h>
Elf32_Ehdr ∗elf32_getehdr(Elf ∗elf);
Elf32_Ehdr ∗elf32_newehdr(Elf ∗elf);
DESCRIPTION
For a 32-bit class file, elf32_getehdr() returns a pointer to an ELF header, if one is available for the ELF descriptor elf. If no header exists for the descriptor, elf32_newehdr() allocates a “clean” one, but it otherwise behaves the same as elf32_getehdr(). It does not allocate a new header if one exists already. If no header exists (for elf32_getehdr()), one cannot be created (for elf32_newehdr()), a system error occurs, the file is not a 32-bit class file, or elf is null, both functions return a null pointer.
The header includes the following members:
unsigned chare_ident[EI_NIDENT];
Elf32_Halfe_type;
Elf32_Halfe_machine;
Elf32_Worde_version;
Elf32_Addre_entry;
Elf32_Offe_phoff;
Elf32_Offe_shoff;
Elf32_Worde_flags;
Elf32_Halfe_ehsize;
Elf32_Halfe_phentsize;
Elf32_Halfe_phnum;
Elf32_Halfe_shentsize;
Elf32_Halfe_shnum;
Elf32_Halfe_shstrndx;
elf32_newehdr() automatically sets the ELF_F_DIRTY bit (see elf_flagdata(3E)). A program may use elf_getident() to inspect the identification bytes from a file.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
| MT-Level | MT-Safe |
SEE ALSO
elf(3E), elf_begin(3E), elf_flagdata(3E), elf_getident(3E), attributes(5)
SunOS 5.6 — Last change: 29 Dec 1996