gelf_update_ehdr(3)

gelf_update_ehdr3

Copy a class-independent elf header into an elf descriptor

Usage

#include <gelf.h>
int gelf_update_ehdr(Elf *elf, GElf_Ehdr *src);

Overview

gelf_update_ehdr() copies the class-independent ELF header from the structure pointed to by src into the ELF descriptor elf . The header is translated as necessary to match the class ( ELFCLASS32 or ELFCLASS64) of the underlying object.

If elf has class ELFCLASS32 then e_entry, e_phoff and e_shoff must be expressible as 32-bit values. This function also marks the Ehdr dirty (see elf_flagehdr()).

Parameters

elf

Pointer to an ELF descriptor of kind ELF_K_ELF.

src

Pointer to a GElf_Ehdr structure that holds the caller’s desired header contents. Must not be NULL.

Return value

On success, gelf_update_ehdr() returns a non-zero value. On failure, it returns 0 and sets elf_errno. If elf is NULL, then 0 is returned without setting elf_errno.

Attributes

InterfaceAttributeValue
gelf_update_ehdr()Thread safetyMT-Safe

Reporting bugs

Report bugs to <[email protected]> or https://sourceware.org/bugzilla/.

From libelf 0.197-1 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.