mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00

The test _ELFUTILS_PREREQ(0, 142) is false for elfutils before 2009-06-13, but that is 15 years ago and very unlikely. Add a test to test-libdw.c and assume the libdw version is at least 0.142 to simplify the build logic. Signed-off-by: Ian Rogers <irogers@google.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Cc: Anup Patel <anup@brainfault.org> Cc: Yang Jihong <yangjihong@bytedance.com> Cc: Palmer Dabbelt <palmer@dabbelt.com> Cc: David S. Miller <davem@davemloft.net> Cc: Albert Ou <aou@eecs.berkeley.edu> Cc: Shenlin Liang <liangshenlin@eswincomputing.com> Cc: Nick Terrell <terrelln@fb.com> Cc: Guilherme Amadio <amadio@gentoo.org> Cc: Steinar H. Gunderson <sesse@google.com> Cc: Changbin Du <changbin.du@huawei.com> Cc: Alexander Lobakin <aleksander.lobakin@intel.com> Cc: Przemek Kitszel <przemyslaw.kitszel@intel.com> Cc: Huacai Chen <chenhuacai@kernel.org> Cc: Guo Ren <guoren@kernel.org> Cc: Masahiro Yamada <masahiroy@kernel.org> Cc: Masami Hiramatsu (Google) <mhiramat@kernel.org> Cc: Will Deacon <will@kernel.org> Cc: James Clark <james.clark@linaro.org> Cc: Mike Leach <mike.leach@linaro.org> Cc: Chen Pei <cp0613@linux.alibaba.com> Cc: Leo Yan <leo.yan@linux.dev> Cc: Oliver Upton <oliver.upton@linux.dev> Cc: Aditya Gupta <adityag@linux.ibm.com> Cc: Kajol Jain <kjain@linux.ibm.com> Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com> Cc: linux-arm-kernel@lists.infradead.org Cc: linux-riscv@lists.infradead.org Cc: Bibo Mao <maobibo@loongson.cn> Cc: John Garry <john.g.garry@oracle.com> Cc: Atish Patra <atishp@rivosinc.com> Cc: Dima Kogan <dima@secretsauce.net> Cc: Paul Walmsley <paul.walmsley@sifive.com> Cc: Dr. David Alan Gilbert <linux@treblig.org> Cc: linux-csky@vger.kernel.org Link: https://lore.kernel.org/r/20241017001354.56973-9-irogers@google.com Signed-off-by: Namhyung Kim <namhyung@kernel.org>
56 lines
1 KiB
C
56 lines
1 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
#include <stdlib.h>
|
|
#include <dwarf.h>
|
|
#include <elfutils/libdw.h>
|
|
#include <elfutils/libdwfl.h>
|
|
#include <elfutils/version.h>
|
|
|
|
int test_libdw(void)
|
|
{
|
|
Dwarf *dbg = dwarf_begin(0, DWARF_C_READ);
|
|
|
|
return (long)dbg;
|
|
}
|
|
|
|
int test_libdw_unwind(void)
|
|
{
|
|
/*
|
|
* This function is guarded via: __nonnull_attribute__ (1, 2).
|
|
* Passing '1' as arguments value. This code is never executed,
|
|
* only compiled.
|
|
*/
|
|
dwfl_thread_getframes((void *) 1, (void *) 1, NULL);
|
|
return 0;
|
|
}
|
|
|
|
int test_libdw_getlocations(void)
|
|
{
|
|
Dwarf_Addr base, start, end;
|
|
Dwarf_Attribute attr;
|
|
Dwarf_Op *op;
|
|
size_t nops;
|
|
ptrdiff_t offset = 0;
|
|
|
|
return (int)dwarf_getlocations(&attr, offset, &base, &start, &end, &op, &nops);
|
|
}
|
|
|
|
int test_libdw_getcfi(void)
|
|
{
|
|
Dwarf *dwarf = NULL;
|
|
|
|
return dwarf_getcfi(dwarf) == NULL;
|
|
}
|
|
|
|
int test_elfutils(void)
|
|
{
|
|
Dwarf_CFI *cfi = NULL;
|
|
|
|
dwarf_cfi_end(cfi);
|
|
return 0;
|
|
}
|
|
|
|
int main(void)
|
|
{
|
|
return test_libdw() + test_libdw_unwind() + test_libdw_getlocations() +
|
|
test_libdw_getcfi() + test_elfutils();
|
|
}
|