GELF_OFFSCN(3) Libelf Programmer's Manual GELF_OFFSCN(3)

gelf_offscn - return descriptor for an ELF section at a given file offset

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

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.

Pointer to an ELF descriptor with kind ELF_K_ELF.
The file offset (in bytes) of the section to be retrieved.

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.

elf32_offscn(3), elf64_offscn(3), libelf(3), elf(5)

Interface Attribute Value
gelf_offscn () Thread safety MT-Safe

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