GELF_GETPHDR(3) Libelf Programmer's Manual GELF_GETPHDR(3)

gelf_getphdr - Retrieve class-independent program header table entries for an ELF object file

#include <gelf.h>
GElf_Phdr *gelf_getphdr (Elf *elf, int ndx, GElf_Phdr *dst);

Retrieve the class-independent program header table entry at index ndx for ELF descriptor elf and store it in dst. See elf_getphdrnum(3) for information on how to acquire the number of entries in the program header table.

ELF descriptor of kind ELF_K_ELF from which to retrieve the program header table entry.
The index of the program header table entry to be retrieved.
Pointer to a caller-provided GElf_Phdr that will receive the requested program header table entry.

On success, the requested entry is copied into dst and dst is returned. On failure, NULL is returned and elf_errno is set. If elf is NULL, then NULL is returned and elf_errno is not set.

elf32_getphdr(3), elf64_getphdr(3), elf_getphdrnum(3), gelf_newphdr(3), gelf_update_phdr(3), libelf(3), elf(5)

Interface Attribute Value
gelf_getphdr () Thread safety MT-Safe

Report bugs to <elfutils-devel@sourceware.org> or https://sourceware.org/bugzilla/.

2025-12-23 Libelf