.TH ELF_HASH 3 2025-03-31 "Libelf" "Libelf Programmer's Manual"
.SH NAME
-elf_hash \- Compute the standard ELF hash of a string.
+elf_hash, elf_gnu_hash \- Compute the standard ELF hash or GNU hash of a string.
.SH SYNOPSIS
.nf
#include <libelf.h>
.BI "unsigned long int elf_hash(const char *" string ");"
+.BI "unsigned long int elf_gnu_hash(const char *" string ");"
.SH DESCRIPTION
The
it avoids generating architecture-dependent values and is suitable for use
across architectures.
+The
+.BR elf_gnu_hash
+function computes the GNU-style hash value of a null-terminated string,
+used in the
+.B SHT_GNU_HASH
+section.
+
.SH PARAMETERS
.TP
.I string
NULL-terminated string to be hashed.
.SH RETURN VALUE
-This function returns the standard ELF hash value for
+These functions return a hash value for
.IR string .
Only the lower 32 bits of the return value are used.
T{
.na
.nh
-.BR elf_hash ()
+.BR elf_hash (),\~elf_gnu_hash ()
T} Thread safety MT-Safe
.TE
.SH REPORTING BUGS
Report bugs to <elfutils-devel@sourceware.org> or https://sourceware.org/bugzilla/.
+
+.SH HISTORY
+.B elf_gnu_hash
+first appeared in elfutils 0.122. This function is a elfutils libelf extension and
+may not be available in other libelf implementations.