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

# elf\_scnshndx(3)

Find the index of the SHT\_SYMTAB\_SHNDX section associated with a symbol table

## NAME

elf\_scnshndx - Find the index of the SHT\_SYMTAB\_SHNDX section associated with a symbol table

## SYNOPSIS

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

## DESCRIPTION

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.

## SEE ALSO

[**libelf**(3)](/libelf/3.md), [**elf**(5)](/elf/5.md)

## ATTRIBUTES

| | | |
| --- | --- | --- |
| **Interface** | **Attribute** | **Value** |
| **elf\_scnshndx**() | Thread safety | MT-Safe |

## REPORTING BUGS

Report bugs to \<elfutils-devel@sourceware.org\> 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.
