elf_getscn(3)

elf_getscn3

Retrieve a descriptor for an elf section at a specified index.

Usage

#include <libelf.h>

Elf_Scn *elf_getscn(Elf *elf, size_t index);

Overview

The elf_getscn function retrieves a section descriptor for the section at the specified index in the ELF object referred to by elf.

Parameters

elf

An Elf pointer to the ELF object from which the section descriptor is to be retrieved.

index

A size_t value representing the index of the section whose descriptor is to be retrieved. Section indices start at 0. The section at index 0 is always SHT_NULL and does not contain any data.

Return value

The elf_getscn function returns a pointer to the Elf_Scn for the section at the specified index. If an error occurs, it returns NULL and sets an appropriate libelf error code.

Attributes

For an explanation of the terms used in this section, see attributes(7).

InterfaceAttributeValue
elf_getscn()Thread safetyMT-Safe

Releases

Unchanged in 2 releases since Debian 13 (Trixie).

  1. 13–Arch

Reporting bugs

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

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