GELF_UPDATE_SYM(3)
π GELF_UPDATE_SYM(3) π
okay bestie, welcome to the Libelf Programmer's Manual β yes we're reading a manpage together, it's a whole vibe, and this one is genuinely iconic. today's episode: gelf_update_sym, the class-independent symbol table entry updater. no cap.
β¨ NAME β¨
gelf_update_sym β update a class-independent symbol table entry π¦
πΈ SYNOPSIS πΈ
#include <gelf.h>
int gelf_update_sym (Elf_Data *data, int ndx, GElf_Sym *src);
π DESCRIPTION π
So basically what this does: it copies a class-independent symbol table entry from src into the SHT_SYMTAB or SHT_DYNSYM section that's associated with data, at entry index ndx. it's giving "here's your symbol, bestie, go live your truth". β¨
Wanna know how many symbols are in the symbol table? math era. divide the size of the corresponding section (sh_size or d_size) by the size of a symbol table entry. and where do you get the size of a symbol table entry? from sh_entsize or gelf_fsize(3). simple as that, periodt.
π¨ important detour, bestie: if the corresponding ELF file has more than 64K sections, thengelf_update_symshndxis the one you need to use to update a symbol's section index in an extended section index table. go readgelf_update_symshndx(3)for the full tea.
π PARAMETERS π
dataβ theElf_Datafor a symbol table section with typeSHT_SYMTABorSHT_DYNSYM. that's the section we're working with, no exceptions.ndxβ the zero-based index of the symbol table entry you want to update withindata. zero-based, so first entry is0, don't come at me with 1-indexed nonsense. πsrcβ pointer to the caller-provided symbol table entry. heads up: forELFCLASS32binaries,st_valueandst_sizeshould be able to fit within unsigned 32-bit values. andsrcmust not beNULLβ like, that's non-negotiable.
π RETURN VALUE π
On success? this function returns a non-zero value and updates the symbol table entry at index ndx in data. and as a lil bonus, the symbol table section associated with data gets flagged with ELF_F_DIRTY β she's marked, she's changed, she knows it. π
On failure, zero is returned and elf_errno is set. classic.
π special case that you need to know: ifdataisNULL, then zero is returned andelf_errnois not set. yeah. it just silently returns zero. rude, but that's the deal.
π SEE ALSO π
go read them, iykyk. π«Ά
β ATTRIBUTES β
- Interface:
gelf_update_sym() - Attribute: Thread safety
- Value:
MT-Safe
so she's MT-Safe, which means you can call her from multiple threads and she won't start drama. slay. π₯
π REPORTING BUGS π
Found a bug? don't suffer in silence, bestie. report bugs to <elfutils-devel@sourceware.org> or hit up https://sourceware.org/bugzilla/. the maintainers wanna know, fr fr. π
and that's the whole page!! thank you for coming to my ted talk, mwah π
this has been Libelf β GELF_UPDATE_SYM(3) β dated 2025-09-07, from the Libelf crew. go forth and update those symbols, you absolute icon. πβ¨
π¦ 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