gelf_offscn(3)

gelf_offscn3

Return descriptor for an elf section at a given file offset

Usage

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

Overview

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

elf

Pointer to an ELF descriptor with kind ELF_K_ELF.

offset

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

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.

Attributes

InterfaceAttributeValue
gelf_offscn()Thread safetyMT-Safe

Reporting bugs

Report bugs to <[email protected]> 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.

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