GELF_GETLIB(3)
β¨ GELF_GETLIB(3) β¨
okay bestie, welcome to the Libelf Programmer's Manual π this one's short, sweet, and honestly kinda niche, but you're gonna eat it up.
πΈ NAME πΈ
gelf_getlib β grab a prelink library out of the table at whatever index you want π«Ά
π SYNOPSIS π
#include <gelf.h>
GElf_Lib *gelf_getlib (Elf_Data *data, int ndx, GElf_Lib *dst);
like... that's the whole vibe. three args, one struct pointer back. iconic π
π¦ DESCRIPTION π¦
so basically: you pull a prelink library table entry out of data at index ndx, and it gets stored into that class-independent representation that dst is pointing at. that's it. that's the function β¨
data must be an Elf_Data* that's associated with a section of type SHT_GNU_LIBLIST. and data->d_type should be ELF_T_LIB. no cap.
ngl, SHT_GNU_LIBLIST sections are the ones the prelink utility uses. if you want the deep lore, it lives at https://sourceware.org/gnu-gabi/prelink.txt π go read it, i'll wait.
π PARAMETERS π
dataβ pointer to anElf_Dataof a section with typeSHT_GNU_LIBLIST. and yeah,data->d_typeshould beELF_T_LIB. that's the assignment, bestie.ndxβ the zero-based index of the prelink library table entry you're asking for, counted withindata. zero-based!! don't come at me with a 1, i will know πdstβ pointer to a caller-providedGElf_Libstructure where the requested prelink library table entry gets stored. must not beNULL. that's not a suggestion, that's a rule π
π RETURN VALUE π
on success? it updates dst with the prelink library table entry you asked for and returns dst. slay. β¨
on failure? it returns NULL and sets elf_errno. periodt.
ok but the special case: ifdataisNULL, thenNULLgets returned without settingelf_errno. so like, don't go checkingelf_errnofor that one, you'll just be confused and i'm protecting you from that π«Ά
π SEE ALSO π
β ATTRIBUTES β
- Interface:
gelf_getlib() - Attribute: Thread safety
- Value:
MT-Safe
so yeah, it's MT-Safe. go off, threads. π§
π REPORTING BUGS π
found something cursed? report bugs to <elfutils-devel@sourceware.org> or hit up https://sourceware.org/bugzilla/. they wanna hear it, fr fr.
π HISTORY π
gelf_getlib first appeared in elfutils 0.95. and heads up bestie: this function is an elfutils libelf extension, which means it may not be available in other libelf implementations. so if you port your code somewhere else and it doesn't exist... that's why. not your fault, not mine, it's just the lore π
and that's the whole page!! π this was the Libelf manual, page GELF_GETLIB(3), dated 2025-12-31. ty for coming to my ted talk, go forth and read your prelink library tables responsibly πβ¨π¦
π¦ 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