ELF32_CHECKSUM(3)
π ELF32_CHECKSUM(3) π
okay bestie, so this is a libelf page β like, the Libelf Programmer's Manual, section 3, and it's about two little functions that do the exact same thing but for two different flavors of ELF file. no gatekeeping, we're learning this together π«Ά
β¨ NAME β¨
elf32_checksum, elf64_checksum β compute the checksum for a 32-bit or 64-bit ELF object file
β¨ SYNOPSIS β¨
#include <libelf.h>
long int elf32_checksum(Elf *elf);
long int elf64_checksum(Elf *elf);
β¨ DESCRIPTION β¨
So basically you call this on an ELF object file β the one referred to by elf β and it hands you back a checksum. iconic. π
The checksum is computed from the permanent parts of the ELF file, and the result is repeatable β meaning if you run it again on the same file, you get the same number back. no surprises, no chaos, we love consistency πΈ
The way it stays repeatable is the tea though: to make that happen, strippable sections are not included in computing the checksum. and SHT_NOBITS sections are also left out of the calculation. not invited to the party, sorry not sorry π
oh and btw? the checksum can be used as a value for DT_CHECKSUM. slay.
β¨ PARAMETERS β¨
elfβ the ELF object file for which the checksum is to be computed. that's it. that's the whole vibe.
β¨ RETURN VALUE β¨
On success, you get the computed checksum back. π
If an error occurs, it returns -1 and sets a libelf error code. so like, check that error, bestie, don't just ignore the -1, that's not the moment for denial π
Also super important: the checksum is always calculated as a 4-byte value. and if long int happens to be larger than 4 bytes? then the checksum gets extended by padding with zeros. so it fits. no drama. β¨
β¨ SEE ALSO β¨
β¨ ATTRIBUTES β¨
For an explanation of the terms used in this section, see attributes(7).
elf32_checksum(),elf64_checksum()β Thread safety β MT-Safe π
(yeah it was a whole table in the original, but we're doing bullets, and the facts are the same, periodt.)
β¨ REPORTING BUGS β¨
Found a bug? Report it to <elfutils-devel@sourceware.org> or over at https://sourceware.org/bugzilla/. go off, we appreciate you π«Ά
and that's the whole page, bestie!! this was Libelf, dated 2024-08-14, filed under ELF32_CHECKSUM(3) β take care of each other and take care of your checksums πβ¨ππ¦
π¦ where this page comes from
- alpine 3.22: elfutils-doc 0.193-r0 Β· GPL-3.0-or-later AND ( GPL-2.0-or-later OR LGPL-3.0-or-later )
- alpine 3.23: elfutils-doc 0.194-r0 Β· GPL-3.0-or-later AND ( GPL-2.0-or-later OR LGPL-3.0-or-later )
- alpine 3.24: elfutils-doc 0.195-r0 Β· GPL-3.0-or-later AND ( GPL-2.0-or-later OR LGPL-3.0-or-later )
- arch rolling: libelf 0.196-1
- arch rolling: libelf 0.197-1 Β· GPL-2.0-or-later OR LGPL-3.0-or-later
- centos-stream 10: elfutils-libelf-devel 0.197-1.el10 Β· GPL-2.0-or-later OR LGPL-3.0-or-later
- centos-stream 9: elfutils-libelf-devel 0.197-1.el9 Β· GPL-2.0-or-later OR LGPL-3.0-or-later
- centos-stream 9: elfutils-libelf-devel 0.197-1.el9 Β· GPL-2.0-or-later OR LGPL-3.0-or-later
- debian trixie: libelf-dev 0.192-4 Β· GPL-3.0-or-later
- fedora 43: elfutils-libelf-devel 0.193-3.fc43 Β· GPL-2.0-or-later OR LGPL-3.0-or-later
- fedora 43: elfutils-libelf-devel 0.193-3.fc43 Β· GPL-2.0-or-later OR LGPL-3.0-or-later
- fedora 43: elfutils-libelf-devel 0.196-1.fc43
- fedora 43: elfutils-libelf-devel 0.196-1.fc43
- fedora 43: elfutils-libelf-devel 0.197-1.fc43 Β· GPL-2.0-or-later OR LGPL-3.0-or-later
- fedora 43: elfutils-libelf-devel 0.197-1.fc43 Β· GPL-2.0-or-later OR LGPL-3.0-or-later
- fedora 44: elfutils-libelf-devel 0.194-5.fc44 Β· GPL-2.0-or-later OR LGPL-3.0-or-later
- fedora 44: elfutils-libelf-devel 0.194-5.fc44 Β· GPL-2.0-or-later OR LGPL-3.0-or-later
- fedora 44: elfutils-libelf-devel 0.196-1.fc44
- fedora 44: elfutils-libelf-devel 0.196-1.fc44
- fedora 44: elfutils-libelf-devel 0.197-1.fc44 Β· GPL-2.0-or-later OR LGPL-3.0-or-later
- fedora 44: elfutils-libelf-devel 0.197-1.fc44 Β· GPL-2.0-or-later OR LGPL-3.0-or-later
- nixos 26.05: elfutils 0.194
- nixpkgs unstable: elfutils 0.195
- opensuse-leap 16.0: libelf-devel 0.192-160000.3.1 Β· GPL-2.0-or-later OR LGPL-3.0-or-later
- opensuse-leap 16.0: libelf-devel 0.192-160000.3.1 Β· GPL-2.0-or-later OR LGPL-3.0-or-later
- opensuse-leap 16.0: libelf-devel 0.192-160000.3.1 Β· GPL-2.0-or-later OR LGPL-3.0-or-later
- opensuse-leap 16.0: libelf-devel 0.192-160000.3.1 Β· GPL-2.0-or-later OR LGPL-3.0-or-later
- ubuntu questing: libelf-dev 0.193-1
- ubuntu resolute: libelf-dev 0.194-4 Β· GPL-3.0-or-later
- ubuntu stonking: libelf-dev 0.196-1 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms