ELF32_NEWEHDR(3)

πŸ“¦
version 0.197 Β· 2 versions
  • 0.197 Β· alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, centos-stream 9, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 15.1 Β· freebsd 14.5, freebsd 15.1, nixpkgs unstable
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, centos-stream 9, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– ELF32_NEWEHDR πŸ’–

okay bestie, welcome to the elf32_newehdr / elf64_newehdr page from the Libelf Programmer's Manual β€” manual section 3, iykyk. this is where you manifest a brand new ELF header, no cap.


✨ NAME ✨

elf32_newehdr, elf64_newehdr β€” create a new ELF header for a 32-bit or 64-bit ELF object file πŸ¦‹


✨ SYNOPSIS ✨

#include <libelf.h>

Elf32_Ehdr *elf32_newehdr(Elf *elf);
Elf64_Ehdr *elf64_newehdr(Elf *elf);

✨ DESCRIPTION ✨

so this function initializes a new ELF header and associates it with elf. πŸ’…

and listen β€” if elf already has an ELF header associated with it, no new header will be created and the existing header will be returned instead. like, it's not gonna make a second one, that's not the vibe. it just hands you the one you already have. 🫢

⚠️ important bestie: an ELF header must be present before calling elf_newscn or elf_newphdr. no header, no service. periodt.

✨ PARAMETERS ✨

  • elf β€” the ELF descriptor for which a new ELF header is to be created. that's the one getting a glow-up. ✨

✨ RETURN VALUE ✨

  • on success, it returns a pointer to the newly created ELF header. πŸŽ€
  • if elf already has an ELF header associated with it, this pre-existing header is returned and no new header is created β€” same energy, no dupe.
  • on failure, it returns NULL and sets a libelf error code. πŸ’€

✨ SEE ALSO ✨


✨ ATTRIBUTES ✨

for an explanation of the terms used in this section, see attributes(7). πŸ‘‘

  • Interface: elf32_newehdr(), elf64_newehdr()
    • Attribute: Thread safety
    • Value: MT-Safe

so yeah, she's MT-Safe, she can hang in multithreaded spaces, no problem. πŸ”₯


✨ REPORTING BUGS ✨

found a bug? spill. report bugs to <elfutils-devel@sourceware.org> or at https://sourceware.org/bugzilla/. πŸ›πŸ’–


and that's the whole page bestie β€” written by the Libelf crew, version dated 2024-08-14, and yeah the footer still says Libelf and ELF32_NEWEHDR(3) because the classics never miss. mwah, go make some headers. πŸ’…βœ¨

πŸ“¦ where this page comes from