ELF Library Functions elf32getphdr(3ELF)
NAME
elf32getphdr, elf32newphdr, elf64getphdr, elf64newphdr -
retrieve class-dependent program header table
SYNOPSIS
cc [ flag ... ] file... -lelf [ library ... ]
#include
Elf32Phdr *elf32getphdr(Elf *elf);
Elf32Phdr *elf32newphdr(Elf *elf, sizet count);
Elf64Phdr *elf64getphdr(Elf *elf);
Elf64Phdr *elf64newphdr(Elf *elf, sizet count);
DESCRIPTION
For a 32-bit class file, elf32getphdr() returns a pointer
to the program execution header table, if one is available
for the ELF descriptor elf.
elf32newphdr() allocates a new table with count entries,
regardless of whether one existed previously, and sets the
ELFDIRTY bit for the table. See elfflagdata(3ELF).
Specifying a zero count deletes an existing table. Note this
behavior differs from that of elf32newehdr() allowing a
program to replace or delete the program header table,
changing its size if necessary. See elf32getehdr(3ELF).
If no program header table exists, the file is not a 32-bit
class file, an error occurs, or elf is NUL, both functions
return a null pointer. Additionally, elf32newphdr() returns
a null pointer if count is 0.
The table is an array of Elf32Phdr structures, each of
which includes the following members:
Elf32Word ptype;
Elf32Off poffset;
Elf32Addr pvaddr;
Elf32Addr ppaddr;
Elf32Word pfilesz;
Elf32Word pmemsz;
Elf32Word pflags;
Elf32Word palign;
SunOS 5.11 Last change: 11 Jul 2001 1
ELF Library Functions elf32getphdr(3ELF)
The Elf64Phdr structures include the following members:
Elf64Word ptype;
Elf64Word pflags;
Elf64Off poffset;
Elf64Addr pvaddr;
Elf64Addr ppaddr;
Elf64Xword pfilesz;
Elf64Xword pmemsz;
Elf64Xword palign;
For the 64-bit class, replace 32 with 64 as appropriate.
The ELF header's ephnum member tells how many entries the
program header table has. See elf32getehdr(3ELF). A program
may inspect this value to determine the size of an existing
table; elf32newphdr() automatically sets the member's value
to count. If the program is building a new file, it is
responsible for creating the file's ELF header before creat-
ing the program header table.
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
ATRIBUTE TYPE ATRIBUTE VALUE
Interface Stability Stable
MT-Level MT-Safe
SEE ALSO
elf(3ELF), elf32getehdr(3ELF), elfbegin(3ELF),
elfflagdata(3ELF), libelf(3LIB), attributes(5)
SunOS 5.11 Last change: 11 Jul 2001 2
|