GELF_UPDATE_EHDR(3)
β¨ GELF_UPDATE_EHDR π
okay bestie, welcome to the Libelf Programmer's Manual π β this one's called gelf_update_ehdr, and it's giving "put my header back where it belongs."
πΈ NAME πΈ
gelf_update_ehdr β copy a class-independent ELF header into an ELF descriptor
like, literally what it says on the tin, no cap π«Ά
β¨ SYNOPSIS β¨
#include <gelf.h>
int gelf_update_ehdr(Elf *elf, GElf_Ehdr *src);
π DESCRIPTION π
okay so. gelf_update_ehdr() takes the class-independent ELF header from the structure that src points at, and copies it into the ELF descriptor elf. obsessed.
and the way it does it?? the header gets translated as necessary so it matches the class of the underlying object β either ELFCLASS32 or ELFCLASS64. it just knows what vibe the object is on π¦
but here's the part where you gotta pay attention, bestie: if elf has class ELFCLASS32, then e_entry, e_phoff and e_shoff must be expressible as 32-bit values. like, that's non-negotiable, the math has to math π₯
also, this function marks the Ehdr dirty β see elf_flagehdr(). it's messy on purpose, that's the point π
π PARAMETERS π
elfβ pointer to an ELF descriptor of kindELF_K_ELF. the main character, obviously.srcβ pointer to aGElf_Ehdrstructure holding the caller's desired header contents. Must not beNULL. do NOT test me on this one π
β RETURN VALUE β
on success, gelf_update_ehdr() returns a non-zero value. slay. β
on failure, it returns 0 and sets elf_errno so you can go find out what went wrong. π΅οΈββοΈ
and if elf is NULL?? then 0 is returned without setting elf_errno. yeah, no error for you, it just says no π
π SEE ALSO π
the whole friend group fr fr π«Ά
π ATTRIBUTES π
- Interface:
gelf_update_ehdr() - Attribute: Thread safety
- Value:
MT-Safe
translation: she is MT-Safe, so multiple threads can hang out with her and nobody's gonna have a bad time. iconic behavior, honestly π
π REPORTING BUGS π
found a bug? don't suffer in silence bestie, report it to <elfutils-devel@sourceware.org> or hit up https://sourceware.org/bugzilla/. they wanna know, fr fr π
and that's the whole page!! this one's from Libelf, dated 2025-09-17, and it lives at section 3 of the manual β GELF_UPDATE_EHDR(3), periodt. πβ¨π§
π¦ 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