gelf_update_phdr3
Copy a class-independent program header table entry into an elf descriptor
Usage
#include <gelf.h> int gelf_update_phdr (Elf *elf, int ndx, GElf_Phdr *src);
Overview
gelf_update_phdr() copies the class-independent program header table entry from the structure pointed to by src into the program header table of elf at index ndx . The program header table entry is translated as necessary to match the class (ELFCLASS32 or ELFCLASS64) of the underlying object file.
If elf has class ELFCLASS32 then p_offset, p_vaddr, p_paddr, p_filesz, p_memsz, and p_align must fit within unsigned 32-bit values.
Parameters
- elf
-
Pointer to an ELF descriptor of kind
ELF_K_ELF.
- ndx
-
Index of the program header table entry to be updated. The number of program header table entries associated with elf can be obtained with
elf_getphdrnum().
- src
-
Pointer to a
GElf_Phdrstructure that holds the caller's desired program header table entry contents. src must not be NULL.
Return value
On success, this function returns a non-zero value and updates the program header table entry at index ndx. The program header table will be flagged with ELF_F_DIRTY. On failure, it returns 0 and sets elf_errno. If elf is NULL then 0 is returned without setting elf_errno.
Attributes
| Interface | Attribute | Value |
| gelf_update_phdr() | Thread safety | MT-Safe |