perf probe: Move elfutils support check to libdw check
authorIan Rogers <irogers@google.com>
Thu, 17 Oct 2024 00:13:51 +0000 (17:13 -0700)
committerNamhyung Kim <namhyung@kernel.org>
Fri, 18 Oct 2024 17:17:40 +0000 (10:17 -0700)
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>
tools/build/feature/test-libdw.c
tools/perf/util/probe-finder.c
tools/perf/util/probe-finder.h

index 71c6f8e3b0eebf95c85f0f53b96e3677485499b7..2fb59479ab77168765fadb50b5468039a924cc4d 100644 (file)
@@ -41,8 +41,16 @@ int test_libdw_getcfi(void)
        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_libdw_getcfi() + test_elfutils();
 }
index a30f88ed030044bc958771f445995af7785e9f01..bb27a406b7c6135033ff1dc5d4a347f8106399e2 100644 (file)
@@ -1379,9 +1379,7 @@ int debuginfo__find_trace_events(struct debuginfo *dbg,
        if (ret >= 0 && tf.pf.skip_empty_arg)
                ret = fill_empty_trace_arg(pev, tf.tevs, tf.ntevs);
 
-#if _ELFUTILS_PREREQ(0, 142)
        dwarf_cfi_end(tf.pf.cfi_eh);
-#endif
 
        if (ret < 0 || tf.ntevs == 0) {
                for (i = 0; i < tf.ntevs; i++)
index 724db829b49e028c11e893af62f58734a524dcb1..5ced3b058fd8c2bfab996bdc189d67f2e5bf8063 100644 (file)
@@ -63,12 +63,10 @@ struct probe_finder {
        struct intlist          *lcache;        /* Line cache for lazy match */
 
        /* For variable searching */
-#if _ELFUTILS_PREREQ(0, 142)
        /* Call Frame Information from .eh_frame. Owned by this struct. */
        Dwarf_CFI               *cfi_eh;
        /* Call Frame Information from .debug_frame. Not owned. */
        Dwarf_CFI               *cfi_dbg;
-#endif
        Dwarf_Op                *fb_ops;        /* Frame base attribute */
        unsigned int            machine;        /* Target machine arch */
        struct perf_probe_arg   *pvar;          /* Current target variable */