GELF_UPDATE_VERSYM(3)

πŸ’– GELF_UPDATE_VERSYM β€” the libelf programmer's manual, section 3, bestie edition πŸ’–

okay so. you know how ELF files have symbol versioning sections and those sections are class-dependent and annoying? yeah. these five functions are the class-independent glow-up that lets you modify them. no cap.


✨ NAME ✨

gelf_update_versym, gelf_update_verdef, gelf_update_verdaux, gelf_update_verneed, gelf_update_vernaux β€” modify class-independent symbol versioning records πŸ¦‹


✨ SYNOPSIS ✨

#include <gelf.h>

int gelf_update_versym (Elf_Data *data, int ndx, GElf_Versym  *src);
int gelf_update_verdef (Elf_Data *data, int offset, GElf_Verdef  *src);
int gelf_update_verdaux(Elf_Data *data, int offset, GElf_Verdaux *src);
int gelf_update_verneed(Elf_Data *data, int offset, GElf_Verneed *src);
int gelf_update_vernaux(Elf_Data *data, int offset, GElf_Vernaux *src);

✨ DESCRIPTION ✨

so these five besties are the ones doing the class-independent modification of GNU ELF symbol versioning sections. like, every single one of them takes whatever you handed them in src and copies that content straight into the symbol versioning entry sitting at the index or offset you named inside data. periodt.

gelf_update_versym() β€” writes a symbol version index into the SHT_GNU_versym section that's associated with data, at index ndx. πŸŽ€

gelf_update_verdef() β€” writes a version definition entry into the SHT_GNU_verdef section that's associated with data, at section offset offset.

gelf_update_verdaux() β€” writes a version definition auxiliary entry into the SHT_GNU_verdef section that's associated with data, at section offset offset. (yes, auxiliary. the lil sidekick entry. iconic.)

gelf_update_verneed() β€” writes a version needed entry into the SHT_GNU_verneed section that's associated with data, at section offset offset.

gelf_update_vernaux() β€” writes a version needed auxiliary entry into the SHT_GNU_verneed section that's associated with data, at section offset offset.


✨ PARAMETERS ✨

  • data β€” an Elf_Data pointer that corresponds to the appropriate GNU symbol versioning section. the vibe check starts here.
  • ndx β€” (this one is for gelf_update_versym() only, bestie, don't get it twisted.) the zero-based index of the entry inside data.
  • offset β€” (this one's for gelf_update_verdef(), gelf_update_verdaux(), gelf_update_verneed(), and gelf_update_vernaux().) the section-relative byte offset of the entry inside data.
  • src β€” pointer to the caller-supplied symbol: GElf_Versym, GElf_Verdef, GElf_Verdaux, GElf_Verneed, or GElf_Vernaux, whichever is appropriate. 🫢
🚨 okay this part matters: this argument must not be NULL. do not pass NULL. i'm literally begging.

✨ RETURN VALUE ✨

when it goes well: these functions store the requested entry in src, mark the section corresponding to data with ELF_F_DIRTY, and hand you back a non-zero value. slay. βœ…

when it goes badly: 0 is returned and elf_errno gets set. 😭

and one lil edge case β€” if data is NULL, you get 0 back without elf_errno being set. no drama, no error code, just vibes. πŸ’€


✨ SEE ALSO ✨

gelf_getverdaux(3), gelf_getverdef(3), gelf_getvernaux(3), gelf_getverneed(3), gelf_getversym(3), libelf(3), elf(5)

(yeah the getters are the mirror images of these. iykyk. 🌈)


✨ ATTRIBUTES ✨

  • Interface: gelf_update_versym(), gelf_update_verdef(), gelf_update_verdaux(), gelf_update_verneed(), gelf_update_vernaux()
    • Attribute: Thread safety
    • Value: MT-Safe πŸ‘‘

✨ REPORTING BUGS ✨

found a bug? don't suffer in silence, tell the maintainers πŸ›

Report bugs to <elfutils-devel@sourceware.org> or at https://sourceware.org/bugzilla/.


and that's the whole page, bestie. this was the libelf programmer's manual, GELF_UPDATE_VERSYM(3), dated 2025-09-27, brought to you by Libelf. go forth and update your versyms responsibly. mwah πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from