Signed-off-by: Aaron Merey <[email protected]>
---
v2: Minor rewording in description and synopsis
doc/Makefile.am | 1 +
doc/elf_gnu_hash.3 | 1 +
doc/elf_hash.3 | 19 ++++++++++++++++---
3 files changed, 18 insertions(+), 3 deletions(-)
create mode 100644 doc/elf_gnu_hash.3
diff --git a/doc/Makefile.am b/doc/Makefile.am
index bb61ad39..7157fc6d 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -76,6 +76,7 @@ notrans_dist_man3_MANS= elf32_checksum.3 \
elf_getshnum.3 \
elf_getshstrndx.3 \
elf_hash.3 \
+ elf_gnu_hash.3 \
elf_kind.3 \
elf_memory.3 \
elf_ndxscn.3 \
diff --git a/doc/elf_gnu_hash.3 b/doc/elf_gnu_hash.3
new file mode 100644
index 00000000..d87463f1
--- /dev/null
+++ b/doc/elf_gnu_hash.3
@@ -0,0 +1 @@
+.so man3/elf_hash.3
diff --git a/doc/elf_hash.3 b/doc/elf_hash.3
index 1e06d888..275a701f 100644
--- a/doc/elf_hash.3
+++ b/doc/elf_hash.3
@@ -1,13 +1,14 @@
.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
@@ -18,13 +19,20 @@ 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
+.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.
@@ -43,9 +51,14 @@ Interface Attribute Value
T{
.na
.nh
-.BR elf_hash ()
+.BR elf_hash (),\~elf_gnu_hash ()
T} Thread safety MT-Safe
.TE
.SH REPORTING BUGS
Report bugs to <[email protected]> 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.
--
2.50.1