ELF32_GETSHDR(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_GETSHDR(3) ✨

okay bestie, welcome to the Libelf Programmer's Manual πŸ’– this one is short, sweet, and lowkey iconic, so let's go


🌸 NAME 🌸

elf32_getshdr, elf64_getshdr β€” grab the section header for a section in a 32-bit or 64-bit ELF object file πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <libelf.h>

Elf32_Shdr *elf32_getshdr(Elf_Scn *scn);
Elf64_Shdr *elf64_getshdr(Elf_Scn *scn);

πŸ’… DESCRIPTION πŸ’…

So basically you call this and it retrieves the section header for the section that scn is pointing at. That's it. That's the whole vibe. 🫢

but listen, this part matters: if the section header you retrieved gets modified, you have to call elf_flagshdr with ELF_C_SET and ELF_F_DIRTY, otherwise your modified section header is not going to disk. it's giving "I edited it but nothing saved" 😭 do not be that girl.

πŸ“ PARAMETERS πŸ“

  • scn β€” the section descriptor whose section header you're trying to retrieve. that's the one. ✨

⭐ RETURN VALUE ⭐

  • On success: a pointer to the section header, slay πŸ’«
  • If scn is NULL: you get NULL back. no drama, just NULL.
  • If an error happens: you get NULL and a libelf error code gets set. πŸ’€

🌈 SEE ALSO 🌈


πŸ‘‘ ATTRIBUTES πŸ‘‘

if you wanna know what these terms even mean, go check attributes(7) β€” it explains it all πŸ’œ

  • elf32_getshdr(), elf64_getshdr() β€” Thread safety: MT-Safe πŸ”₯

πŸ™ˆ REPORTING BUGS πŸ™ˆ

found a bug? don't suffer in silence, tell the people:


and that's the whole page, bestie. go forth and get those section headers. periodt. πŸ’…βœ¨

this lil masterpiece is from Libelf, dated 2024-08-14 β€” mwah, sending you off with a kiss and a 2024-08-14 timestamp πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from