]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
doc: Add gelf_checksum.3
authorAaron Merey <amerey@redhat.com>
Thu, 1 Jan 2026 02:50:45 +0000 (21:50 -0500)
committerAaron Merey <amerey@redhat.com>
Fri, 13 Mar 2026 18:46:52 +0000 (14:46 -0400)
Signed-off-by: Aaron Merey <amerey@redhat.com>
doc/Makefile.am
doc/gelf_checksum.3 [new file with mode: 0644]

index 5d12f0a7d3048b50a4daed9c91f5a4640e029e9c..35e158b477da6cbd5577db67997fb54316860b36 100644 (file)
@@ -91,6 +91,7 @@ notrans_dist_man3_MANS= elf32_checksum.3 \
                        elf_strptr.3 \
                        elf_update.3 \
                        elf_version.3 \
+                       gelf_checksum.3 \
                        gelf_fsize.3 \
                        gelf_getauxv.3 \
                        gelf_getchdr.3 \
diff --git a/doc/gelf_checksum.3 b/doc/gelf_checksum.3
new file mode 100644 (file)
index 0000000..1389daa
--- /dev/null
@@ -0,0 +1,70 @@
+.TH GELF_CHECKSUM 3 2025-12-31 "Libelf" "Libelf Programmer's Manual"
+
+.SH NAME
+gelf_checksum \- compute the checksum for an ELF object file
+
+.SH SYNOPSIS
+.nf
+.B #include <gelf.h>
+
+.BI "long int gelf_checksum (Elf *" elf ");"
+
+.SH DESCRIPTION
+Compute a checksum for the ELF object file referred to by
+.IR elf .
+This function acts as a wrapper around
+.BR elf32_checksum ()
+and
+.BR elf64_checksum ().
+The binary class of
+.I elf
+is used to automatically select between
+.BR elf32_checksum ()
+and
+.BR elf64_checksum ().
+
+The checksum is computed from permanent parts of the ELF file and
+the result is repeatable.  To be repeatable, strippable sections are
+not included in computing the checksum.
+.B SHT_NOBITS
+sections are also not included when computing the checksum.  The checksum
+can be used as a value for
+.BR DT_CHECKSUM .
+
+.SH PARAMETERS
+.TP
+.I elf
+The ELF object file for which the checksum is to be computed.
+
+.SH RETURN VALUE
+On success, return the computed checksum. On failure, return -1
+and set elf_errno.  If
+.I elf
+is NULL then -1 is returned without setting elf_errno.
+
+The checksum is always calculated as a 4-byte value. If
+.I long int
+is larger than 4 bytes, then the checksum will be extended by padding
+with zeros.
+
+.SH SEE ALSO
+.BR elf32_checksum (3),
+.BR elf64_checksum (3),
+.BR libelf (3),
+.BR elf (5)
+
+.SH ATTRIBUTES
+.TS
+allbox;
+lbx lb lb
+l l l.
+Interface      Attribute       Value
+T{
+.na
+.nh
+.BR gelf_checksum ()
+T}     Thread safety   MT-Safe
+.TE
+
+.SH REPORTING BUGS
+Report bugs to <elfutils-devel@sourceware.org> or https://sourceware.org/bugzilla/.