GELF_GETSYM(3)
๐ GELF_GETSYM โ bestie, it's literally the symbol table translator โจ
okay so this is gelf_getsym from the Libelf Programmer's Manual (that's the GELF_GETSYM(3) bit, if you were wondering ๐) and honestly? she's an icon. she takes a symbol table entry and gives it back to you in a form that doesn't care what class your ELF is. no cap.
โจ NAME โจ
gelf_getsym โ grab class-independent symbol info from the symbol table at the index you ask for ๐ฆ
๐ธ SYNOPSIS ๐ธ
#include <gelf.h>
GElf_Sym *gelf_getsym (Elf_Data *data, int ndx, GElf_Sym *dst);
๐ DESCRIPTION ๐
so the vibe is: you've got a symbol table entry at index ndx sitting inside data, and this function translates it into a class-independent representation and drops it into *dst. iconic behaviour. ๐
data must be the Elf_Data of a section whose type is SHT_SYMTAB or SHT_DYNSYM. that's the rule, periodt.
want to know how many symbols are in the symbol table? math time bestie ๐งฎ โ divide the size of the corresponding section (sh_size or d_size) by the size of one symbol table entry. and where does that size come from? sh_entsize or gelf_fsize(3). you're welcome. โจ
๐จ heads up: if the corresponding elf has more than 64K sections, you should be usinggelf_getsymshndxto get a symbol's section index instead. go checkgelf_getsymshndx(3)for the details, fr fr.
๐ PARAMETERS ๐
dataโ pointer to anElf_Dataof aSHT_SYMTABorSHT_DYNSYMsection. ๐ซndxโ the zero-based index of the symbol table entry insidedata. (zero-based, bestie, not one-based, we don't do that here ๐)dstโ pointer to a structure you provide, where the symbol table entry gets stored. and listen โdstmust not beNULL. like, at all. ๐ซถ
โญ RETURN VALUE โญ
slay on success โ returns dst. ๐
flop on failure โ returns NULL and sets elf_errno. ๐ญ
BUT. tiny plot twist: if data is NULL, then NULL is returned without setting elf_errno. so don't go blaming the errno for that one, it's innocent. ๐
๐ฆ SEE ALSO ๐ฆ
๐ ATTRIBUTES ๐
(sorry bestie, no tables allowed in this format, so here's the tea in list form ๐)
- Interface:
gelf_getsym() - Attribute: Thread safety
- Value:
MT-Safe๐ฅ
๐ REPORTING BUGS ๐
found a bug? spill it, don't sit on it:
- email
<elfutils-devel@sourceware.org>, or - hit up https://sourceware.org/bugzilla/
Libelf ยท 2025-12-29 ยท GELF_GETSYM(3) โ that's the whole page babes, go translate some symbols, you ate ๐ โจ๐ซถ
๐ฆ 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