elf_scnshndx(3)

elf_scnshndx3

Find the index of the sht_symtab_shndx section associated with a symbol table

Usage

#include <libelf.h>
int elf_scnshndx(Elf_Scn *scn);

Overview

The elf_scnshndx() function searches for the SHT_SYMTAB_SHNDX section associated with a given symbol table section. It returns the section index of the corresponding SHT_SYMTAB_SHNDX section, or zero if none is found.

This function is used for retrieving extended section indices in ELF files with many sections, where standard symbol table entries cannot store all possible section references directly.

The function only returns a valid result if scn refers to a section of type SHT_SYMTAB. Otherwise, the function returns 0.

Parameters

scn

An Elf_Scn pointer referencing a symbol table section.

Return value

Returns the section index of the SHT_SYMTAB_SHNDX section if found. If no such section is found, returns 0. On error, returns -1.

Attributes

InterfaceAttributeValue
elf_scnshndx()Thread safetyMT-Safe

Reporting bugs

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

History

elf_scnshndx first appeared in elfutils 0.132. This function is a elfutils libelf extension and may not be available in other libelf implementations.

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