GELF_OFFSCN(3)
π GELF_OFFSCN(3) π
okay bestie, welcome to section 3 of the Libelf Programmer's Manual, where we're talking about gelf_offscn β yes that's the whole vibe, let's go β¨
πΈ NAME πΈ
gelf_offscn β return a descriptor for an ELF section sitting at a given file offset π―
β¨ SYNOPSIS β¨
#include <gelf.h>
Elf_Scn *gelf_offscn(Elf *elf, GElf_Off offset);
π DESCRIPTION π
so basically, gelf_offscn() goes and retrieves the section descriptor for the non-empty section whose sh_offset equals offset. that's it, that's the whole job π«Ά
heads up though: this function will not return descriptors for SHT_NOBITS sections, because those are empty by definition. like, no bits, no entry. it's giving "you can't sit with us" π
π PARAMETERS π
- elf β pointer to an ELF descriptor with kind
ELF_K_ELF. gotta be the right kind of elf, no impostors π - offset β the file offset (in bytes) of the section you want back. bytes, bestie, not vibes β¨
β RETURN VALUE β
on success, gelf_offscn() hands you a pointer to the Elf_Scn of the non-empty section whose sh_offset matches offset. iconique, no notes π
on failure, NULL comes back and elf_errno gets set to tell you what went wrong. π
little plot twist: if elf isNULL, thenNULLis returned without settingelf_errno. yes, that's a special case, yes, you should remember it fr fr
π SEE ALSO π
the whole friend group, go say hi π
π¦ ATTRIBUTES π¦
gelf_offscn()β Thread safety:MT-Safe
that's it. MT-Safe. she's safe, she's thread-friendly, she's lowkey the moment π§
π REPORTING BUGS π
found a bug? don't be shy, report it to <elfutils-devel@sourceware.org> or at https://sourceware.org/bugzilla/. the devs wanna know, periodt π£
π HISTORY π
gelf_offscn first appeared in elfutils 0.112. also, important tea: this elfutils libelf function may not be found in other libelf implementations. so if you're porting code, check first, bestie, no cap π
and that's the page!! this lil legend lives in the Libelf manual, dated 2025-09-22, and yes you clocked it β GELF_OFFSCN(3), section 3, exactly where you left her. mwah, go read some sections ππβ¨
π¦ where this page comes from
- alpine 3.24: elfutils-doc 0.195-r0 Β· GPL-3.0-or-later AND ( GPL-2.0-or-later OR LGPL-3.0-or-later )
- arch rolling: libelf 0.196-1
- arch rolling: libelf 0.197-1 Β· GPL-2.0-or-later OR LGPL-3.0-or-later
- centos-stream 10: elfutils-libelf-devel 0.197-1.el10 Β· GPL-2.0-or-later OR LGPL-3.0-or-later
- centos-stream 9: elfutils-libelf-devel 0.197-1.el9 Β· GPL-2.0-or-later OR LGPL-3.0-or-later
- centos-stream 9: elfutils-libelf-devel 0.197-1.el9 Β· GPL-2.0-or-later OR LGPL-3.0-or-later
- fedora 43: elfutils-libelf-devel 0.196-1.fc43
- fedora 43: elfutils-libelf-devel 0.196-1.fc43
- fedora 43: elfutils-libelf-devel 0.197-1.fc43 Β· GPL-2.0-or-later OR LGPL-3.0-or-later
- fedora 43: elfutils-libelf-devel 0.197-1.fc43 Β· GPL-2.0-or-later OR LGPL-3.0-or-later
- fedora 44: elfutils-libelf-devel 0.196-1.fc44
- fedora 44: elfutils-libelf-devel 0.196-1.fc44
- fedora 44: elfutils-libelf-devel 0.197-1.fc44 Β· GPL-2.0-or-later OR LGPL-3.0-or-later
- fedora 44: elfutils-libelf-devel 0.197-1.fc44 Β· GPL-2.0-or-later OR LGPL-3.0-or-later
- nixpkgs unstable: elfutils 0.195
- ubuntu stonking: libelf-dev 0.196-1 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms