]> git.ipfire.org Git - thirdparty/elfutils.git/commit
libelf: Add gelf_fsize main check
authorMark Wielaard <mark@klomp.org>
Mon, 8 Dec 2025 10:44:45 +0000 (11:44 +0100)
committerMark Wielaard <mark@klomp.org>
Mon, 15 Dec 2025 21:52:40 +0000 (22:52 +0100)
commit4544ed87b7b4d6143cca1bfbd3d5042d02c7a2c9
treeaa6fab25f9756aae5361d412fbf01ce50f64af9f
parent361bab598419c4aea1d8f1ab0304cc52bfc82cda
libelf: Add gelf_fsize main check

This test itself isn't super interesting, it just checks that all
Elf_Types are handled by gelf_fsize and that the 32 vs 64 variant
sizes make sense. The interesting part is that it uses the internal
interface (__libelf_type_sizes) to do it. So you don't have to
contruct a whole Elf handle.

It mimics the support for "main checks" in libdw. It adds a way to
compile an individual source file with an optional main function that
can directly access the internal/static functions.

To add new main check tests you have to add an #ifdef MAIN_CHECK with
a main function that calls the test functions to the source file. And
add two make file rules after .SECONDEXPANSION. One starting with
<source_basename>_checks$(EXEEXT) and one starting with
nodist_<source_basename>_check_SOURCES.

* libelf/gelf_fsize.c: Add MAIN_CHECK part.
* libelf/Makefile.am: Add gelf_fsize main check rules.

Signed-off-by: Mark Wielaard <mark@klomp.org>
libelf/Makefile.am
libelf/gelf_fsize.c