@@ -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();
}
@@ -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++)
@@ -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 */
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> --- tools/build/feature/test-libdw.c | 10 +++++++++- tools/perf/util/probe-finder.c | 2 -- tools/perf/util/probe-finder.h | 2 -- 3 files changed, 9 insertions(+), 5 deletions(-)