---
name: "gelf_getsymshndx"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["linux", "freebsd"]
url: "https://new.carta.tech/gelf_getsymshndx"
---

# gelf\_getsymshndx(3)

read and update symbol information using extended section indices

## NAME

**gelf\_getsymshndx**, **gelf\_update\_symshndx** – read and update symbol information using extended section indices

## LIBRARY

library “libelf”

## SYNOPSIS

**#include \<gelf.h\>**

*GElf\_Sym \**\

**gelf\_getsymshndx**(*Elf\_Data \*symdata*, *Elf\_Data \*xndxdata*, *int ndx*, *GElf\_Sym \*sym*, *Elf32\_Word \*xndxptr*);

*int*\

**gelf\_update\_symshndx**(*Elf\_Data \*symdata*, *Elf\_Data \*xndxdata*, *int ndx*, *GElf\_Sym \*sym*, *Elf32\_Word xndx*);

## DESCRIPTION

These functions are analogous to **gelf\_getsym**() and **gelf\_update\_sym**() respectively, but are capable of handling symbol tables using extended section numbering.

Argument *symdata* is an *Elf\_Data* descriptor associated with a section of type SHT\_SYMTAB. Argument *xndxdata* is an *Elf\_Data* descriptor associated with a section of type SHT\_SYMTAB\_SHNDX. Argument *ndx* is the index of the symbol table entry being retrieved or updated. Argument *sym* is a pointer to a class-independent *GElf\_Sym* structure. *GElf\_Sym* structures are described in detail in [gelf(3)](/gelf/3.md).

Function **gelf\_getsymshndx**() retrieves symbol information at index *ndx* from the data descriptor specified by argument *symdata* and stores in class-independent form in argument *sym*. In addition it retrieves the extended section index for the symbol from data buffer *xndxdata* and stores it into the location pointed to by argument *xndxptr*.

Function **gelf\_update\_symshndx**() updates the underlying symbol table entry in data descriptor *symdata* with the information in argument *sym*. In addition it sets the extended section index in data buffer *xndxdata* to the value of argument *xndx*.

## RETURN VALUES

Function **gelf\_getsymshndx**() returns the value of argument *sym* if successful, or NULL in case of an error.

Function **gelf\_update\_symshndx**() returns a non-zero value if successful, or zero in case of an error.

## ERRORS

These functions may fail with the following errors:

- \[ELF\_E\_ARGUMENT\]

  Arguments *symdata*, *xndxdata*, *xndxptr* or *sym* were NULL.

- \[ELF\_E\_ARGUMENT\]

  Argument *ndx* was less than zero, or too large for either of descriptors *symdata* or *xndxdata*.

- \[ELF\_E\_ARGUMENT\]

  Data descriptor *symdata* was not associated with a section of type SHT\_SYMTAB.

- \[ELF\_E\_ARGUMENT\]

  Data descriptor *xndxdata* was not associated with a section of type SHT\_SYMTAB\_SHNDX.

- \[ELF\_E\_ARGUMENT\]

  Data descriptor *symdata* and *xndxdata* were associated with different ELF objects.

- \[ELF\_E\_VERSION\]

  The *Elf\_Data* descriptors denoted by arguments *symdata* and *xndxdata* are associated with an ELF object with an unsupported version.

## SEE ALSO

[elf(3)](/elf/3.md), [elf\_getdata(3)](/elf_getdata/3.md), [elf\_getscn(3)](/elf_getscn/3.md), [gelf(3)](/gelf/3.md), [gelf\_getsym(3)](/gelf_getsym/3.md), [gelf\_update\_sym(3)](/gelf_update_sym/3.md)
