GELF_UPDATE_SYM(3)

πŸ“¦
version 0.197 Β· 2 versions
, in alpine 3.24, arch rolling, centos-stream 10, centos-stream 9, fedora 43, fedora 44, nixpkgs unstable, ubuntu stonking

πŸ’– 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, then gelf_update_symshndx is the one you need to use to update a symbol's section index in an extended section index table. go read gelf_update_symshndx(3) for the full tea.

πŸŽ€ PARAMETERS πŸŽ€

  • data β€” the Elf_Data for a symbol table section with type SHT_SYMTAB or SHT_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 within data. zero-based, so first entry is 0, don't come at me with 1-indexed nonsense. πŸ™ˆ
  • src β€” pointer to the caller-provided symbol table entry. heads up: for ELFCLASS32 binaries, st_value and st_size should be able to fit within unsigned 32-bit values. and src must not be NULL β€” 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: if data is NULL, then zero is returned and elf_errno is 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