ELF32_GETEHDR(3)
π ELF32_GETEHDR(3) π
okay so bestie, we're in the Libelf Programmer's Manual and this is the page for elf32_getehdr. yes it's a mouthful. yes it slays. let's go π¦
β¨ NAME β¨
elf32_getehdr β grab the ELF header for a 32-bit ELF descriptor, no cap π
πΈ SYNOPSIS πΈ
#include <libelf.h>
Elf32_Ehdr *elf32_getehdr(Elf *elf);
π DESCRIPTION π
so elf32_getehdr retrieves the ELF header for the 32-bit ELF descriptor you hand it, elf. like, it goes and gets it for you. queen behavior.
and the ELF header is not a vibe-light thing β it's holding crucial metadata about the ELF file. we're talking:
- the type
- the machine
- the version
- the entry point
- the program header table offset
- the section header table offset
if you wanna know more about the ELF header itself, go read elf(5). it's giving lore. πβ¨
π«Ά PARAMETERS π«Ά
elfβ a pointer to the ELF descriptor you want the ELF header from. that's the one. that's your girl.
π RETURN VALUE π
on success? elf32_getehdr hands you a pointer to the Elf32_Ehdr structure. periodt. π
but if the ELF descriptor is invalid, or it's not a 32-bit ELF? it returns NULL, and sets an error code you can retrieve with elf_errno(3). so likeβ¦ go check that. don't just sit there staring at your NULL, bestie π
π₯ SEE ALSO π₯
π REPORTING BUGS π
found a bug? not me being the one to tell you β report it to <elfutils-devel@sourceware.org> or hit up https://sourceware.org/bugzilla/. the maintainers will literally thank you π«Ά
okay that's the whole page, mwah π this lil libelf moment was brought to you by the Libelf manual, dated 2024-06-26. go forth and get those headers, bestie π§π
π¦ where this page comes from
- alpine 3.22: elfutils-doc 0.193-r0 Β· GPL-3.0-or-later AND ( GPL-2.0-or-later OR LGPL-3.0-or-later )
- 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
- debian trixie: libelf-dev 0.192-4 Β· GPL-3.0-or-later
- fedora 43: elfutils-libelf-devel 0.193-3.fc43 Β· GPL-2.0-or-later OR LGPL-3.0-or-later
- fedora 43: elfutils-libelf-devel 0.193-3.fc43 Β· 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
- opensuse-leap 16.0: libelf-devel 0.192-160000.3.1 Β· GPL-2.0-or-later OR LGPL-3.0-or-later
- opensuse-leap 16.0: libelf-devel 0.192-160000.3.1 Β· GPL-2.0-or-later OR LGPL-3.0-or-later
- opensuse-leap 16.0: libelf-devel 0.192-160000.3.1 Β· GPL-2.0-or-later OR LGPL-3.0-or-later
- opensuse-leap 16.0: libelf-devel 0.192-160000.3.1 Β· GPL-2.0-or-later OR LGPL-3.0-or-later
- ubuntu questing: libelf-dev 0.193-1
- 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