GELF_GETCLASS(3)
β¨ GELF_GETCLASS β¨
okay bestie, so you know how every ELF file out there is either living that 32-bit life or that 64-bit life? yeah. this little function from the Libelf Programmer's Manual tells you which one you're looking at. it's giving β¨vibe check for binariesβ¨ and honestly? iconic. π
πΈ NAME πΈ
gelf_getclass β bestie, this returns the ELF class (32-bit or 64-bit) for an object π
π¦ SYNOPSIS π¦
#include <gelf.h>
int gelf_getclass(Elf *elf);
like. that's it. one include, one function, one Elf *. slay. π
π DESCRIPTION π
so gelf_getclass() returns the class of the ELF object that elf points at. no cap.
if you've got a valid ELF file on your hands, the class is gonna be one of these two gorgeous options:
ELFCLASS32β the object is a 32-bit ELF class. tiny. adorable. still valid. πELFCLASS64β the object is a 64-bit ELF class. big. powerful. main character energy. π
and if elf is not denoting a valid ELF object, or the class literally cannot be determined? you get ELFCLASSNONE back. π the void. the nothingness. we don't love that for you but it's the truth.
π₯ RETURN VALUE π₯
on success you get ELFCLASS32 or ELFCLASS64. periodt. π«Ά
but listen β if elf is NULL, or if it doesn't refer to a valid ELF binary with kind ELF_K_ELF, then ELFCLASSNONE is what you're getting back. so uh. check that pointer, bestie. π
π SEE ALSO π
go read those too, iykyk. β¨
π ATTRIBUTES π
- Interface β
gelf_getclass() - Attribute β Thread safety
- Value β MT-unsafe race
β οΈ okay so real talk: MT-unsafe race. that means if you're out here threading this call all willy-nilly, that's a race condition. be careful, queen. π
π REPORTING BUGS π
found a bug? not the cute kind? π report it to <elfutils-devel@sourceware.org> or hit up https://sourceware.org/bugzilla/. they'll love you for it. fr fr. π«Ά
and that's the whole page, bestie!! this was Libelf, dated 2025-09-14, brought to you by the Libelf Programmer's Manual β go forth and check your classes. mwah. πβ¨π¦
π¦ where this page comes from
- alpine 3.23: elfutils-doc 0.194-r0 Β· GPL-3.0-or-later AND ( GPL-2.0-or-later OR LGPL-3.0-or-later )
- 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.194-5.fc44 Β· GPL-2.0-or-later OR LGPL-3.0-or-later
- fedora 44: elfutils-libelf-devel 0.194-5.fc44 Β· 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
- nixos 26.05: elfutils 0.194
- nixpkgs unstable: elfutils 0.195
- ubuntu resolute: libelf-dev 0.194-4 Β· GPL-3.0-or-later
- 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