gelf_getsym - Man Page

Retrieve class-independent symbol information from the symbol table at the given index

Synopsis

#include <gelf.h>

GElf_Sym *gelf_getsym (Elf_Data *data, int ndx, GElf_Sym *dst);

Description

Translate the symbol table entry at index ndx from data into a class-independent representation stored in *dst.

data must be the Elf_Data of a section with type SHT_SYMTAB or SHT_DYNSYM.

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 contains more than 64K sections then gelf_getsymshndx should be used to retrieve a symbol's section index.  See gelf_getsymshndx(3) for more information.

Parameters

data

Pointer to an Elf_Data of a SHT_SYMTAB or SHT_DYNSYM section.

ndx

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

dst

Pointer to a caller-provided structure for storing the symbol table entry. dst must not be NULL.

Return Value

On success, this function returns dst. On failure, it returns NULL and sets elf_errno.  If data is NULL, then NULL is returned without setting elf_errno.

See Also

gelf_getdyn(3), gelf_getsymshndx(3), gelf_update_sym(3), libelf(3), elf(5)

Attributes

InterfaceAttributeValue
gelf_getsym()Thread safetyMT-Safe

Reporting Bugs

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

Referenced By

gelf_getsyminfo(3), gelf_getsymshndx(3), gelf_update_sym(3), gelf_update_syminfo(3).

2025-12-29 Libelf Programmer's Manual