summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Stone <jistone@redhat.com>2009-08-10 13:01:30 -0700
committerJosh Stone <jistone@redhat.com>2009-08-10 13:01:30 -0700
commit6a38401c78a02b9bd14e50966ecdd54a003597b7 (patch)
tree756865ad341d322f3e47bae5d398ebb23ba48209
parent23d106b9c554c2b32dfb8c94dc963834f65ef7df (diff)
downloadsystemtap-steved-6a38401c78a02b9bd14e50966ecdd54a003597b7.tar.gz
systemtap-steved-6a38401c78a02b9bd14e50966ecdd54a003597b7.tar.xz
systemtap-steved-6a38401c78a02b9bd14e50966ecdd54a003597b7.zip
Simplify _ELFUTILS_PREREQ checking
We were jumping through a few hoops to deal with elfutils < 0.138 that did not have the _ELFUTILS_PREREQ macro. I've added an always-false dummy macro to take its place when it doesn't exit. All of the other "#ifdef _ELFUTILS_PREREQ" ugliness can now go away.
-rw-r--r--dwarf_wrappers.h13
-rw-r--r--dwflpp.cxx7
-rw-r--r--dwflpp.h15
-rw-r--r--loc2c-test.c7
-rw-r--r--translate.cxx14
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);
diff --git a/dwflpp.cxx b/dwflpp.cxx
index 9d0f3f4d..e436a9ca 100644
--- a/dwflpp.cxx
+++ b/dwflpp.cxx
@@ -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;
diff --git a/dwflpp.h b/dwflpp.h
index f6305bcf..b376d004 100644
--- a/dwflpp.h
+++ b/dwflpp.h
@@ -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;