gelf_update_sym - Man Page

update a class-independent symbol table entry

Synopsis

#include <gelf.h>

int gelf_update_sym (Elf_Data *data, int ndx, GElf_Sym *src);

Description

Copy a class-independent symbol table entry from src into the SHT_SYMTAB or SHT_DYNSYM section associated with data at entry index ndx.

The number of symbols in the symbol table can be calculated by dividing the size of the corresponding section (sh_size or d_size) by the size of a symbol table entry.  The size of a symbol table entry can be obtained from sh_entsize or gelf_fsize(3).

If the corresponding ELF file contains more than 64K sections then gelf_update_symshndx should be used to update a symbol's section index in an extended section index table.  See gelf_update_symshndx(3) for more information.

Parameters

data

Elf_Data for a symbol table section with type SHT_SYMTAB or SHT_DYNSYM.

ndx

Zero-based index of the symbol table entry to be updated within data.

src

Pointer to the caller-provided symbol table entry.  For ELFCLASS32 binaries, st_value and st_size should be able to fit within unsigned 32-bit values. src must not be NULL.

Return Value

On success, this function returns a non-zero value and updates the symbol table entry at index ndx in data. The symbol table section associated with data will be flagged with ELF_F_DIRTY. On failure, zero is returned and elf_errno is set.  If data is NULL, then zero is returned and elf_errno is not set.

See Also

gelf_getsym(3), gelf_update_symshndx(3), libelf(3), elf(5)

Attributes

InterfaceAttributeValue
gelf_update_sym()Thread safetyMT-Safe

Reporting Bugs

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

Referenced By

gelf_getsym(3), gelf_update_symshndx(3).

2025-09-07 Libelf Programmer's Manual