GELF\_OFFSCN(3) Libelf Programmer's Manual GELF\_OFFSCN(3)

# [NAME](#NAME)

gelf\_offscn - return descriptor for an ELF section at a given file offset

# [SYNOPSIS](#SYNOPSIS)

```
#include <gelf.h>
Elf_Scn *gelf_offscn(Elf *elf, GElf_Off offset);
```

# [DESCRIPTION](#DESCRIPTION)

**gelf\_offscn**() retrieves the section descriptor for the non-empty section with **sh\_offset** equal to *offset*. This function will not return descriptors for **SHT\_NOBITS** sections since they are empty by definition.

# [PARAMETERS](#PARAMETERS)

[*elf*](#elf)

Pointer to an ELF descriptor with kind **ELF\_K\_ELF**.

[*offset*](#offset)

The file offset (in bytes) of the section to be retrieved.

# [RETURN VALUE](#RETURN_VALUE)

On success, **gelf\_offscn**() returns a pointer to the *Elf\_Scn* of the non-empty section with a sh\_offset matching *offset*.

On failure, **NULL** is returned and elf\_errno is set to indicate the error. If *elf* is NULL, then NULL is returned without setting elf\_errno.

# [SEE ALSO](#SEE_ALSO)

[**elf32\_offscn**(3)](/man/os/elfutils/elf32_offscn.3), [**elf64\_offscn**(3)](/man/os/elfutils/elf64_offscn.3), [**libelf**(3)](/man/os/elfutils/libelf.3), [**elf**(5)](/man/os/elfutils/elf.5)

# [ATTRIBUTES](#ATTRIBUTES)

**Interface** **Attribute** **Value** gelf\_offscn () Thread safety MT-Safe

# [REPORTING BUGS](#REPORTING_BUGS)

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

HISTORY **gelf\_offscn** first appeared in elfutils 0.112. This elfutils libelf function may not be found in other libelf implementations.

2025-09-22 Libelf

---

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