Signed-off-by: Aaron Merey <ame...@redhat.com> --- v2: Mention use with SHT_HASH and clarify that only the lower 32 bits of the return value are used.
doc/Makefile.am | 1 + doc/elf_hash.3 | 51 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 doc/elf_hash.3 diff --git a/doc/Makefile.am b/doc/Makefile.am index 00cdc253..343b5460 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -58,6 +58,7 @@ notrans_dist_man3_MANS= elf32_checksum.3 \ elf_getbase.3 \ elf_getdata.3 \ elf_getscn.3 \ + elf_hash.3 \ elf_ndxscn.3 \ elf_update.3 \ elf_version.3 \ diff --git a/doc/elf_hash.3 b/doc/elf_hash.3 new file mode 100644 index 00000000..1e06d888 --- /dev/null +++ b/doc/elf_hash.3 @@ -0,0 +1,51 @@ +.TH ELF_HASH 3 2025-03-31 "Libelf" "Libelf Programmer's Manual" + +.SH NAME +elf_hash \- Compute the standard ELF hash of a string. + +.SH SYNOPSIS +.nf +#include <libelf.h> + +.BI "unsigned long int elf_hash(const char *" string ");" + +.SH DESCRIPTION +The +.B 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. + +.SH PARAMETERS +.TP +.I string +NULL-terminated string to be hashed. + +.SH RETURN VALUE +This function returns the standard ELF hash value for +.IR string . +Only the lower 32 bits of the return value are used. + +.SH SEE ALSO +.BR libelf (3), +.BR elf (5) + +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lbx lb lb +l l l. +Interface Attribute Value +T{ +.na +.nh +.BR elf_hash () +T} Thread safety MT-Safe +.TE + +.SH REPORTING BUGS +Report bugs to <elfutils-devel@sourceware.org> or https://sourceware.org/bugzilla/. -- 2.49.0