From fcc30d6d020ebf1df7d05809074015c8f0990c22 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 23 Jun 2009 10:20:07 +0200 Subject: PR 10313 Build error due to deprecation of elf_getshstrndx in elfutils. * dwflpp.h: Check elfutils version, define elf_getshdrstrndx as elf_getshstrndx if elfutils 0.142 detected. * dwflpp.cxx (get_blacklist_section): Use elf_getshdrstrndx. * tapsets.cxx (probe_table): Likewise. (prepare_section_rejection): Likewise. --- dwflpp.cxx | 2 +- dwflpp.h | 7 +++++++ tapsets.cxx | 6 +++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/dwflpp.cxx b/dwflpp.cxx index 61627e16..5991d1a1 100644 --- a/dwflpp.cxx +++ b/dwflpp.cxx @@ -2316,7 +2316,7 @@ dwflpp::get_blacklist_section(Dwarf_Addr addr) { Elf_Scn* scn = 0; size_t shstrndx; - dwfl_assert ("getshstrndx", elf_getshstrndx (elf, &shstrndx)); + dwfl_assert ("getshdrstrndx", elf_getshdrstrndx (elf, &shstrndx)); while ((scn = elf_nextscn (elf, scn)) != NULL) { GElf_Shdr shdr_mem; diff --git a/dwflpp.h b/dwflpp.h index 9cd2cb59..7260c417 100644 --- a/dwflpp.h +++ b/dwflpp.h @@ -25,6 +25,13 @@ extern "C" { #include +#ifdef HAVE_ELFUTILS_VERSION_H + #include + #if !_ELFUTILS_PREREQ(0,142) + // Always use newer name, old name is deprecated in 0.142. + #define elf_getshdrstrndx elf_getshstrndx + #endif +#endif #include } diff --git a/tapsets.cxx b/tapsets.cxx index 7aee6930..6be7de11 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -699,7 +699,7 @@ dwarf_builder::probe_table::probe_table(string& mark_name, systemtap_session & s elf = dwfl_module_getelf (dw->module, &bias); Elf_Scn *probe_scn = NULL; - dwfl_assert ("getshstrndx", elf_getshstrndx (elf, &shstrndx)); + dwfl_assert ("getshdrstrndx", elf_getshdrstrndx (elf, &shstrndx)); have_probes = false; @@ -723,7 +723,7 @@ dwarf_builder::probe_table::probe_table(string& mark_name, systemtap_session & s elf = dwarf_getelf (dwfl_module_getdwarf (dw->module, &bias)); if (! elf) return; - dwfl_assert ("getshstrndx", elf_getshstrndx (elf, &shstrndx)); + dwfl_assert ("getshdrstrndx", elf_getshdrstrndx (elf, &shstrndx)); probe_scn = NULL; while ((probe_scn = elf_nextscn (elf, probe_scn))) { @@ -3702,7 +3702,7 @@ symbol_table::prepare_section_rejection(Dwfl_Module *mod) if (!elf) return; - if (elf_getshstrndx(elf, &shstrndx) != 0) + if (elf_getshdrstrndx (elf, &shstrndx) != 0) return; while ((scn = elf_nextscn(elf, scn)) != NULL) { -- cgit