Files
erofs-linux/tools/build/feature/test-libelf-zstd.c
T
Leo Yan d557814cdf tools build: Add feature test for libelf with ZSTD
The macro ELFCOMPRESS_ZSTD defines the compress algorithm, which was
introduced in the commit ("libelf: Document and make ELFCOMPRESS_ZSTD
usable with old system elf.h") of the repository elfutils-0.188-67.
Therefore, libelf 0.189 and later versions require to link the libzstd
library.

Add a test for checking if libelf supports ZSTD algorithm.  Pass the
macro ELFCOMPRESS_ZSTD as an argument to the elf_compress() function.
If the build succeeds, it means the feature is supported.

Reviewed-by: Quentin Monnet <[email protected]>
Signed-off-by: Leo Yan <[email protected]>
Tested-by: Namhyung Kim <[email protected]>
Tested-by: Quentin Monnet <[email protected]>
Acked-by: Andrii Nakryiko <[email protected]>
Acked-by: Jiri Olsa <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Alexei Starovoitov <[email protected]>
Cc: Daniel Borkmann <[email protected]>
Cc: Eduard Zingerman <[email protected]>
Cc: Guilherme Amadio <[email protected]>
Cc: Hao Luo <[email protected]>
Cc: Ian Rogers <[email protected]>
Cc: James Clark <[email protected]>
Cc: John Fastabend <[email protected]>
Cc: KP Singh <[email protected]>
Cc: Kan Liang <[email protected]>
Cc: Martin KaFai Lau <[email protected]>
Cc: Nick Terrell <[email protected]>
Cc: Song Liu <[email protected]>
Cc: Stanislav Fomichev <[email protected]>
Cc: Yonghong Song <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2024-12-18 16:24:32 -03:00

10 lines
149 B
C

// SPDX-License-Identifier: GPL-2.0
#include <stddef.h>
#include <libelf.h>
int main(void)
{
elf_compress(NULL, ELFCOMPRESS_ZSTD, 0);
return 0;
}