ELF\_GETSCN(3) Libelf Programmer's Manual ELF\_GETSCN(3)

# [NAME](#NAME)

elf\_getscn - retrieve a descriptor for an ELF section at a specified index.

# [SYNOPSIS](#SYNOPSIS)

**#include &lt;libelf.h&gt;**

**Elf\_Scn \*elf\_getscn(Elf \*elf, size\_t index);**

# [DESCRIPTION](#DESCRIPTION)

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

# [PARAMETERS](#PARAMETERS)

[*elf*](#elf)

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

[*index*](#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](#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](#ATTRIBUTES)

For an explanation of the terms used in this section, see [**attributes**(7)](/man/os/elfutils/attributes.7).

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

# [SEE ALSO](#SEE_ALSO)

[**elf\_errno**(3)](/man/os/elfutils/elf_errno.3), [**libelf**(3)](/man/os/elfutils/libelf.3), [**elf**(5)](/man/os/elfutils/elf.5)

# [REPORTING BUGS](#REPORTING_BUGS)

Report bugs to &lt;elfutils-devel@sourceware.org&gt; or https://sourceware.org/bugzilla/.

2024-07-18 Libelf

---

Document: elf_getscn(3) from elfutils 0.197-r0 (Chainguard OS)
Source: https://sourceware.org/git/elfutils.git
