---
name: "gelf_getsym"
section: "3"
platform: "linux"
package: "libelf"
version: "0.197-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux", "freebsd"]
url: "https://new.carta.tech/gelf_getsym"
---

# gelf\_getsym(3)

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

## NAME

gelf\_getsym - 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)](/gelf_fsize/3.md).

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)](/gelf_getsymshndx/3.md) 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_getdyn/3.md), [**gelf\_getsymshndx**(3)](/gelf_getsymshndx/3.md), [**gelf\_update\_sym**(3)](/gelf_update_sym/3.md), [**libelf**(3)](/libelf/3.md), [**elf**(5)](/elf/5.md)

## ATTRIBUTES

| | | |
| --- | --- | --- |
| **Interface** | **Attribute** | **Value** |
| **gelf\_getsym**() | Thread safety | MT-Safe |

## REPORTING BUGS

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