ELF_HASH(3)
π ELF_HASH(3) π
okay bestie, welcome to libelf's cute lil hash corner, from the Libelf Programmer's Manual β¨ this page covers elf_hash and elf_gnu_hash β yes they're basically twins, and yes you're gonna love them π
πΈ NAME πΈ
elf_hash, elf_gnu_hash β compute the standard ELF hash or GNU hash of a string π§
β¨ SYNOPSIS β¨
#include <libelf.h>
unsigned long int elf_hash(const char *string);
unsigned long int elf_gnu_hash(const char *string);
π¦ DESCRIPTION π¦
so elf_hash computes the standard ELF hash value for a null-terminated string, periodt. these hash values are typically used in ELF object files for symbol table hashing β very demure, very mindful π
the way this one is used in SHT_HASH sectionsβ¦ it's because it avoids generating architecture-dependent values and is suitable for use across architectures. it's giving portable queen π
meanwhile elf_gnu_hash computes the GNU-style hash value of a null-terminated string, and it's the one used in the SHT_GNU_HASH section. different section, same slay π
π PARAMETERS π
stringβ aNULL-terminated string to be hashed. give it a string, bestie, and it gets hashed π
β RETURN VALUE β
these functions return a hash value for string. but lowkey important: only the lower 32 bits of the return value are used π so don't go getting attached to the whole unsigned long int, ok?
π SEE ALSO π
π ATTRIBUTES π
for an explanation of the terms used in this section, see attributes(7).
elf_hash(),elf_gnu_hash()β Thread safety: MT-Safe π₯ (yes bestie, they're thread-safe, we love to see it)
π REPORTING BUGS π
found a bug? not the vibe fr fr. report it to <elfutils-devel@sourceware.org> or hit up https://sourceware.org/bugzilla/ π«Ά
π°οΈ HISTORY π°οΈ
elf_gnu_hash first appeared in elfutils 0.122 π
β οΈ heads up bestie: this function is an elfutils libelf extension and may not be available in other libelf implementations. so likeβ¦ vibe check your libelf before you commit, iykyk π
and that's the whole page, no cap. this cutie dropped as part of Libelf, dated 2025-03-31, filed under ELF_HASH(3) β go forth and hash responsibly, bestie πβ¨ππ¦πΈπ π«Ά
π¦ 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