elf_hash - Man Page

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

The elf_hash function computes the standard ELF hash value for a null-terminated string.  The hash values are typically used in ELF object files for symbol table hashing.  The hash function is used in SHT_HASH sections as it avoids generating architecture-dependent values and is suitable for use across architectures.

The elf_gnu_hash function computes the GNU-style hash value of a null-terminated string, used in the SHT_GNU_HASH section.

Parameters

string

NULL-terminated string to be hashed.

Return Value

These functions return a hash value for string. Only the lower 32 bits of the return value are used.

See Also

libelf(3), elf(5)

Attributes

For an explanation of the terms used in this section, see attributes(7).

InterfaceAttributeValue
elf_hash(), elf_gnu_hash()Thread safetyMT-Safe

Reporting Bugs

Report bugs to <elfutils-devel@sourceware.org> or https://sourceware.org/bugzilla/.

History

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.

Referenced By

The man page elf_gnu_hash(3) is an alias of elf_hash(3).

2025-03-31 Libelf Programmer's Manual