diff options
-rw-r--r-- | dwarf_wrappers.h | 13 | ||||
-rw-r--r-- | dwflpp.cxx | 7 | ||||
-rw-r--r-- | dwflpp.h | 15 | ||||
-rw-r--r-- | loc2c-test.c | 7 | ||||
-rw-r--r-- | translate.cxx | 14 |
5 files changed, 26 insertions, 30 deletions
diff --git a/dwarf_wrappers.h b/dwarf_wrappers.h index 959ece92..9233fc1d 100644 --- a/dwarf_wrappers.h +++ b/dwarf_wrappers.h @@ -8,10 +8,23 @@ #ifndef DWARF_WRAPPERS_H #define DWARF_WRAPPERS_H 1 + +#include "config.h" + +extern "C" { #include <elfutils/libdw.h> +#ifdef HAVE_ELFUTILS_VERSION_H +#include <elfutils/version.h> +#endif +} #include <string> +#if !defined(_ELFUTILS_PREREQ) +// make a dummy PREREQ check for elfutils < 0.138 +#define _ELFUTILS_PREREQ(major, minor) (0 >= 1) +#endif + // NB: "rc == 0" means OK in this case void dwfl_assert(const std::string& desc, int rc); @@ -41,9 +41,6 @@ extern "C" { #include <fcntl.h> #include <elfutils/libdwfl.h> #include <elfutils/libdw.h> -#ifdef HAVE_ELFUTILS_VERSION_H -#include <elfutils/version.h> -#endif #include <dwarf.h> #include <elf.h> #include <obstack.h> @@ -2593,9 +2590,8 @@ dwflpp::get_cfa_ops (Dwarf_Addr pc) clog << "get_cfa_ops @0x" << hex << pc << dec << ", module_start @0x" << hex << module_start << dec << endl; -#ifdef _ELFUTILS_PREREQ #if _ELFUTILS_PREREQ(0,142) - // Try debug_frame first, then fall back on eh_frame. + // Try debug_frame first, then fall back on eh_frame. size_t cfa_nops; Dwarf_Addr bias; Dwarf_CFI *cfi = dwfl_module_dwarf_cfi (module, &bias); @@ -2630,7 +2626,6 @@ dwflpp::get_cfa_ops (Dwarf_Addr pc) } #endif -#endif if (sess.verbose > 2) clog << (cfa_ops == NULL ? "not " : " ") << "found cfa" << endl; @@ -25,19 +25,14 @@ extern "C" { #include <elfutils/libdwfl.h> -#ifdef HAVE_ELFUTILS_VERSION_H - #include <elfutils/version.h> - #if !_ELFUTILS_PREREQ(0,142) - // Always use newer name, old name is deprecated in 0.142. - #define elf_getshdrstrndx elf_getshstrndx - #endif -#else - // Really old elfutils version, definitely redefine to use old name. - #define elf_getshdrstrndx elf_getshstrndx -#endif #include <regex.h> } +#if !_ELFUTILS_PREREQ(0,142) +// Always use newer name, old name is deprecated in 0.142. +#define elf_getshdrstrndx elf_getshstrndx +#endif + struct func_info; struct inline_instance_info; diff --git a/loc2c-test.c b/loc2c-test.c index 79cb3296..3c260385 100644 --- a/loc2c-test.c +++ b/loc2c-test.c @@ -21,6 +21,11 @@ #include <stdarg.h> #include "loc2c.h" +#if !defined(_ELFUTILS_PREREQ) +// make a dummy PREREQ check for elfutils < 0.138 +#define _ELFUTILS_PREREQ(major, minor) (0 >= 1) +#endif + #define _(msg) msg static void __attribute__ ((noreturn)) @@ -519,7 +524,6 @@ main (int argc, char **argv) { Dwarf_Op *cfa_ops = NULL; -#ifdef _ELFUTILS_PREREQ #if _ELFUTILS_PREREQ(0,142) size_t cfa_nops; Dwarf_Addr bias; @@ -546,7 +550,6 @@ main (int argc, char **argv) } } #endif -#endif handle_variable (scopes, n, out, cubias, &vardie, pc, cfa_ops, &argv[argi]); diff --git a/translate.cxx b/translate.cxx index 1ddc1778..b8e22e49 100644 --- a/translate.cxx +++ b/translate.cxx @@ -26,9 +26,6 @@ extern "C" { #include <elfutils/libdwfl.h> -#ifdef HAVE_ELFUTILS_VERSION_H -#include <elfutils/version.h> -#endif } using namespace std; @@ -4545,22 +4542,15 @@ dump_unwindsyms (Dwfl_Module *m, // Enable workaround for elfutils dwfl bug. // see https://bugzilla.redhat.com/show_bug.cgi?id=465872 // and http://sourceware.org/ml/systemtap/2008-q4/msg00579.html -#ifdef _ELFUTILS_PREREQ - #if _ELFUTILS_PREREQ(0,138) +#if _ELFUTILS_PREREQ(0,138) // Let's standardize to the buggy "end of build-id bits" behavior. build_id_vaddr += build_id_len; - #endif - #if !_ELFUTILS_PREREQ(0,141) - #define NEED_ELFUTILS_BUILDID_WORKAROUND - #endif -#else - #define NEED_ELFUTILS_BUILDID_WORKAROUND #endif // And check for another workaround needed. // see https://bugzilla.redhat.com/show_bug.cgi?id=489439 // and http://sourceware.org/ml/systemtap/2009-q1/msg00513.html -#ifdef NEED_ELFUTILS_BUILDID_WORKAROUND +#if !_ELFUTILS_PREREQ(0,141) if (build_id_vaddr < base && dwfl_module_relocations (m) == 1) { GElf_Addr main_bias; |