diff mbox series

Move dwarf_reader::status facilities to an abigail::elf_reader namespace

Message ID 20211112161316.22107-1-jose.marchesi@oracle.com
State New
Headers show
Series Move dwarf_reader::status facilities to an abigail::elf_reader namespace | expand

Commit Message

Jose E. Marchesi Nov. 12, 2021, 4:13 p.m. UTC
The DWARF reader is no longer the only ELF-based reader in libabigail:
the CTF reader also operates on ELF files.  Other ELF-based formats
(such as BTF) may also join in the future.  These readers share a lot
of similarities: they all operate on object files, they fetch
debugging information from certain sections, they rely on the symtab
of the read object, the debugging info may be in a separated file (for
certain formats) and so on.

It follows that a lot of logic can be shared among all the ELF-based
readers.  This patch is oriented to that direction.

A new namespace, abigail::elf_reader, is introduced with the goal of
holding features and definitions useful for any ELF-based abigail
reader.  Then all the definitions related to the status resulting from
extracting a corpus from an object file (the dwarf_reader::status) are
moved to abigail::elf_reader.  The utilities and tests are adjusted
accordingly.

Tested in x86_64.
No regressions observed.

Signed-off-by: Jose E. Marchesi <jose.marchesi@oracle.com>

	* include/abg-reader-status.h: New file.
	* include/abg-dwarf-reader.h (enum status): Move to
	abg-reader-status.h.
	(status_to_diagnostic_string): Likewise.
	(operator|): Likewise.
	(operator&): Likewise.
	(operator|=): Likewise.
	(operator&=): Likewise.
	Include abg-reader-status.h.
	* include/Makefile.am (pkginclude_HEADERS): Add
	abg-elf-reader-status.h.
	* src/abg-elf-reader-status.cc: New file.
	* src/abg-dwarf-reader.cc (operator|): Move to
	abg-elf-reader-status.cc.
	(operator&): Likewise.
	(operator|): Likewise.
	(operator|=): Likewise.
	(operator&=): Likewise.
	(status_to_diagnostic_string): Likewise.
	* src/Makefile.am (libabigail_la_SOURCES): Add
	elf-reader-status.cc.
	* src/abg-tools-utils.cc: Use abigail::elf_reader instead of
	abigail::dwarf_reader for the status definitions.
	* tools/abicompat.cc: Likewise.
	* tools/abidiff.cc: Likewise.
	* tools/abidw.cc: Likewise.
	* tools/abilint.cc: Likewise.
	* tools/abipkgdiff.cc: Likewise.
	* tests/print-diff-tree.cc: Likewise.
	* tests/test-diff-dwarf.cc: Likewise.
	* tests/test-read-dwarf.cc: Likewise.
	* tests/test-symtab.cc: Likewise.
	* tests/test-ir-walker.cc: Likewise.
---
 include/Makefile.am             |  1 +
 include/abg-dwarf-reader.h      | 47 +++-------------------
 include/abg-elf-reader-status.h | 66 +++++++++++++++++++++++++++++++
 src/Makefile.am                 |  1 +
 src/abg-dwarf-reader.cc         | 55 +-------------------------
 src/abg-elf-reader-status.cc    | 87 +++++++++++++++++++++++++++++++++++++++++
 src/abg-tools-utils.cc          |  2 +-
 tests/print-diff-tree.cc        |  6 +--
 tests/test-diff-dwarf.cc        |  4 +-
 tests/test-ir-walker.cc         |  2 +-
 tests/test-read-dwarf.cc        |  4 +-
 tests/test-symtab.cc            | 24 ++++++------
 tools/abicompat.cc              | 20 +++++-----
 tools/abidiff.cc                | 17 ++++----
 tools/abidw.cc                  | 10 ++---
 tools/abilint.cc                |  8 ++--
 tools/abipkgdiff.cc             | 38 +++++++++---------
 17 files changed, 230 insertions(+), 162 deletions(-)
 create mode 100644 include/abg-elf-reader-status.h
 create mode 100644 src/abg-elf-reader-status.cc

Comments

Dodji Seketeli Nov. 15, 2021, 11:12 a.m. UTC | #1
Hello Jose,

"Jose E. Marchesi via Libabigail" <libabigail@sourceware.org> a écrit:

> The DWARF reader is no longer the only ELF-based reader in libabigail:
> the CTF reader also operates on ELF files.  Other ELF-based formats
> (such as BTF) may also join in the future.  These readers share a lot
> of similarities: they all operate on object files, they fetch
> debugging information from certain sections, they rely on the symtab
> of the read object, the debugging info may be in a separated file (for
> certain formats) and so on.
>
> It follows that a lot of logic can be shared among all the ELF-based
> readers.  This patch is oriented to that direction.
>
> A new namespace, abigail::elf_reader, is introduced with the goal of
> holding features and definitions useful for any ELF-based abigail
> reader.  Then all the definitions related to the status resulting from
> extracting a corpus from an object file (the dwarf_reader::status) are
> moved to abigail::elf_reader.  The utilities and tests are adjusted
> accordingly.

OK, this makes sense to me.  I have applied the patch with some minor
modifications that I'll explain below.

> diff --git a/include/abg-elf-reader-status.h b/include/abg-elf-reader-status.h

I have renamed this file abg-elf-reader-common.h because as you noted
above, several other facilities are going to be factorized out of the
DWARF reader for the purpose of sharing them with across the ELF-based
readers.  The abg-elf-reader-common.h header file will thus hold the
declaration of those facilities.

> new file mode 100644
> index 00000000..b18f3d9b
> --- /dev/null
> +++ b/include/abg-elf-reader-status.h
> @@ -0,0 +1,66 @@
> +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
> +// -*- Mode: C++ -*-
> +//
> +// Copyright (C) 2013-2020 Red Hat, Inc.
> +//
> +// Author: Dodji Seketeli

Heh, I am not the author of this one, obviously ;-) I have put your name
in there and set Oracle, Inc as copyright holder.  ;-)

[...]

> diff --git a/src/abg-elf-reader-status.cc b/src/abg-elf-reader-status.cc
> new file mode 100644
> index 00000000..c42667e8
> --- /dev/null
> +++ b/src/abg-elf-reader-status.cc
> @@ -0,0 +1,87 @@
> +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
> +// -*- Mode: C++ -*-
> +//
> +// Copyright (C) 2013-2020 Red Hat, Inc.
> +//
> +// Author: Dodji Seketeli

Likewise .

[...]

So  I have updated the other files that refer to
abg-elf-reader-status.{h,cc} accordingly.

[...]

> Signed-off-by: Jose E. Marchesi <jose.marchesi@oracle.com>

Applied to master.

Thanks!

Cheers,
Jose E. Marchesi Nov. 15, 2021, 4:41 p.m. UTC | #2
> Hello Jose,
>
> "Jose E. Marchesi via Libabigail" <libabigail@sourceware.org> a écrit:
>
>> The DWARF reader is no longer the only ELF-based reader in libabigail:
>> the CTF reader also operates on ELF files.  Other ELF-based formats
>> (such as BTF) may also join in the future.  These readers share a lot
>> of similarities: they all operate on object files, they fetch
>> debugging information from certain sections, they rely on the symtab
>> of the read object, the debugging info may be in a separated file (for
>> certain formats) and so on.
>>
>> It follows that a lot of logic can be shared among all the ELF-based
>> readers.  This patch is oriented to that direction.
>>
>> A new namespace, abigail::elf_reader, is introduced with the goal of
>> holding features and definitions useful for any ELF-based abigail
>> reader.  Then all the definitions related to the status resulting from
>> extracting a corpus from an object file (the dwarf_reader::status) are
>> moved to abigail::elf_reader.  The utilities and tests are adjusted
>> accordingly.
>
> OK, this makes sense to me.  I have applied the patch with some minor
> modifications that I'll explain below.
>
>> diff --git a/include/abg-elf-reader-status.h b/include/abg-elf-reader-status.h
>
> I have renamed this file abg-elf-reader-common.h because as you noted
> above, several other facilities are going to be factorized out of the
> DWARF reader for the purpose of sharing them with across the ELF-based
> readers.  The abg-elf-reader-common.h header file will thus hold the
> declaration of those facilities.

Yes that was my next step in the World Domination Plan ;)

>> new file mode 100644
>> index 00000000..b18f3d9b
>> --- /dev/null
>> +++ b/include/abg-elf-reader-status.h
>> @@ -0,0 +1,66 @@
>> +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
>> +// -*- Mode: C++ -*-
>> +//
>> +// Copyright (C) 2013-2020 Red Hat, Inc.
>> +//
>> +// Author: Dodji Seketeli
>
> Heh, I am not the author of this one, obviously ;-) I have put your name
> in there and set Oracle, Inc as copyright holder.  ;-)

Hm, I don't think that's appropriate.  The patch merely moves contents
from one file to another, rather verbatim.  You are the author of these
contents and the copyright of these contents is RedHat's.  That's why I
kept the authorship and the copyright notice.

>
> [...]
>
>> diff --git a/src/abg-elf-reader-status.cc b/src/abg-elf-reader-status.cc
>> new file mode 100644
>> index 00000000..c42667e8
>> --- /dev/null
>> +++ b/src/abg-elf-reader-status.cc
>> @@ -0,0 +1,87 @@
>> +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
>> +// -*- Mode: C++ -*-
>> +//
>> +// Copyright (C) 2013-2020 Red Hat, Inc.
>> +//
>> +// Author: Dodji Seketeli
>
> Likewise .
>
> [...]
>
> So  I have updated the other files that refer to
> abg-elf-reader-status.{h,cc} accordingly.
>
> [...]
>
>> Signed-off-by: Jose E. Marchesi <jose.marchesi@oracle.com>
>
> Applied to master.
>
> Thanks!
>
> Cheers,
diff mbox series

Patch

diff --git a/include/Makefile.am b/include/Makefile.am
index 9e5e037b..0f316878 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -5,6 +5,7 @@  abg-interned-str.h	\
 abg-ir.h		\
 abg-corpus.h		\
 abg-reader.h		\
+abg-elf-reader-status.h \
 abg-dwarf-reader.h	\
 abg-writer.h		\
 abg-comparison.h	\
diff --git a/include/abg-dwarf-reader.h b/include/abg-dwarf-reader.h
index a328fb0e..f7ad4564 100644
--- a/include/abg-dwarf-reader.h
+++ b/include/abg-dwarf-reader.h
@@ -18,6 +18,7 @@ 
 #include <elfutils/libdwfl.h>
 #include "abg-corpus.h"
 #include "abg-suppression.h"
+#include "abg-elf-reader-status.h"
 
 namespace abigail
 {
@@ -28,42 +29,6 @@  namespace dwarf_reader
 
 using namespace abigail::ir;
 
-/// The status of the @ref read_corpus_from_elf() call.
-enum status
-{
-  /// The status is in an unknown state
-  STATUS_UNKNOWN = 0,
-
-  /// This status is for when the call went OK.
-  STATUS_OK = 1,
-
-  /// This status is for when the debug info could not be read.
-  STATUS_DEBUG_INFO_NOT_FOUND = 1 << 1,
-
-  /// This status is for when the alternate debug info could not be
-  /// found.
-  STATUS_ALT_DEBUG_INFO_NOT_FOUND = 1 << 2,
-
-  /// This status is for when the symbols of the ELF binaries could
-  /// not be read.
-  STATUS_NO_SYMBOLS_FOUND = 1 << 3,
-};
-
-string
-status_to_diagnostic_string(status s);
-
-status
-operator|(status, status);
-
-status
-operator&(status, status);
-
-status&
-operator|=(status&, status);
-
-status&
-operator&=(status&, status);
-
 /// The kind of ELF file we are looking at.
 enum elf_type
 {
@@ -111,17 +76,17 @@  void
 set_read_context_corpus_group(read_context& ctxt, corpus_group_sptr& group);
 
 corpus_sptr
-read_corpus_from_elf(read_context& ctxt, status& stat);
+read_corpus_from_elf(read_context& ctxt, elf_reader::status& stat);
 
 corpus_sptr
 read_corpus_from_elf(const std::string& elf_path,
 		     const vector<char**>& debug_info_root_paths,
 		     ir::environment*	environment,
 		     bool		load_all_types,
-		     status&);
+		     elf_reader::status&);
 
 corpus_sptr
-read_and_add_corpus_to_group_from_elf(read_context&, corpus_group&, status&);
+read_and_add_corpus_to_group_from_elf(read_context&, corpus_group&, elf_reader::status&);
 
 bool
 lookup_symbol_from_elf(const environment*		env,
@@ -140,12 +105,12 @@  bool
 refers_to_alt_debug_info(const read_context&	ctxt,
 			 string&		alt_di_path);
 
-status
+elf_reader::status
 has_alt_debug_info(read_context&	ctxt,
 		   bool&		has_alt_di,
 		   string&		alt_debug_info_path);
 
-status
+elf_reader::status
 has_alt_debug_info(const string&	elf_path,
 		   char**		debug_info_root_path,
 		   bool&		has_alt_di,
diff --git a/include/abg-elf-reader-status.h b/include/abg-elf-reader-status.h
new file mode 100644
index 00000000..b18f3d9b
--- /dev/null
+++ b/include/abg-elf-reader-status.h
@@ -0,0 +1,66 @@ 
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+// -*- Mode: C++ -*-
+//
+// Copyright (C) 2013-2020 Red Hat, Inc.
+//
+// Author: Dodji Seketeli
+
+/// @file
+///
+/// This file contains declarations implementing the different status
+/// in which a corpus read from an ELF file can result.  It is used by
+/// the readers based on ELF files, such as DWARF and CTF.
+
+#ifndef __ABG_ELF_READER_STATUS__
+#define __ABG_ELF_READER_STATUS__
+
+#include <string>
+
+namespace abigail
+{
+
+/// The namespace for an ELF based reader.
+namespace elf_reader
+{
+
+/// The status of the @ref read_corpus_from_elf() call.
+enum status
+{
+  /// The status is in an unknown state
+  STATUS_UNKNOWN = 0,
+
+  /// This status is for when the call went OK.
+  STATUS_OK = 1,
+
+  /// This status is for when the debug info could not be read.
+  STATUS_DEBUG_INFO_NOT_FOUND = 1 << 1,
+
+  /// This status is for when the alternate debug info could not be
+  /// found.
+  STATUS_ALT_DEBUG_INFO_NOT_FOUND = 1 << 2,
+
+  /// This status is for when the symbols of the ELF binaries could
+  /// not be read.
+  STATUS_NO_SYMBOLS_FOUND = 1 << 3,
+};
+
+std::string
+status_to_diagnostic_string(status s);
+
+status
+operator|(status, status);
+
+status
+operator&(status, status);
+
+status&
+operator|=(status&, status);
+
+status&
+operator&=(status&, status);
+
+}// end namespace elf_reader
+
+}// end namespace abigail
+
+#endif //__ABG_ELF_READER_STATUS__
diff --git a/src/Makefile.am b/src/Makefile.am
index b60d74cb..6b92f2c9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -26,6 +26,7 @@  abg-suppression-priv.h			\
 abg-suppression.cc			\
 abg-comp-filter.cc			\
 abg-reader.cc				\
+abg-elf-reader-status.cc		\
 abg-dwarf-reader.cc			\
 abg-libxml-utils.cc			\
 abg-hash.cc				\
diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc
index 74ab95f3..e5d54fa1 100644
--- a/src/abg-dwarf-reader.cc
+++ b/src/abg-dwarf-reader.cc
@@ -56,6 +56,7 @@  ABG_END_EXPORT_DECLARATIONS
 #endif
 
 using std::string;
+using namespace abigail::elf_reader;
 
 namespace abigail
 {
@@ -15394,60 +15395,6 @@  build_ir_node_from_die(read_context&	ctxt,
                                 true);
 }
 
-status
-operator|(status l, status r)
-{
-  return static_cast<status>(static_cast<unsigned>(l)
-			     | static_cast<unsigned>(r));
-}
-
-status
-operator&(status l, status r)
-{
-  return static_cast<status>(static_cast<unsigned>(l)
-			     & static_cast<unsigned>(r));
-}
-
-status&
-operator|=(status& l, status r)
-{
-  l = l | r;
-  return l;
-}
-
-status&
-operator&=(status& l, status r)
-{
-  l = l & r;
-  return l;
-}
-
-/// Emit a diagnostic status with english sentences to describe the
-/// problems encoded in a given abigail::dwarf_reader::status, if
-/// there is an error.
-///
-/// @param status the status to diagnose
-///
-/// @return a string containing sentences that describe the possible
-/// errors encoded in @p s.  If there is no error to encode, then the
-/// empty string is returned.
-string
-status_to_diagnostic_string(status s)
-{
-  string str;
-
-  if (s & STATUS_DEBUG_INFO_NOT_FOUND)
-    str += "could not find debug info\n";
-
-  if (s & STATUS_ALT_DEBUG_INFO_NOT_FOUND)
-    str += "could not find alternate debug info\n";
-
-  if (s & STATUS_NO_SYMBOLS_FOUND)
-    str += "could not load ELF symbols\n";
-
-  return str;
-}
-
 /// Create a dwarf_reader::read_context.
 ///
 /// @param elf_path the path to the elf file the context is to be used for.
diff --git a/src/abg-elf-reader-status.cc b/src/abg-elf-reader-status.cc
new file mode 100644
index 00000000..c42667e8
--- /dev/null
+++ b/src/abg-elf-reader-status.cc
@@ -0,0 +1,87 @@ 
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+// -*- Mode: C++ -*-
+//
+// Copyright (C) 2013-2020 Red Hat, Inc.
+//
+// Author: Dodji Seketeli
+
+/// @file
+///
+/// This file contains the implementation of facilities to deal with
+/// status codes related to ELF based readers.
+
+#include "config.h"
+
+#include "abg-internal.h"
+
+// <headers defining libabigail's API go under here>
+ABG_BEGIN_EXPORT_DECLARATIONS
+
+#include "abg-elf-reader-status.h"
+
+ABG_END_EXPORT_DECLARATIONS
+// </headers defining libabigail's API>
+
+namespace abigail
+{
+
+namespace elf_reader
+{
+
+status
+operator|(status l, status r)
+{
+  return static_cast<status>(static_cast<unsigned>(l)
+			     | static_cast<unsigned>(r));
+}
+
+status
+operator&(status l, status r)
+{
+  return static_cast<status>(static_cast<unsigned>(l)
+			     & static_cast<unsigned>(r));
+}
+
+status&
+operator|=(status& l, status r)
+{
+  l = l | r;
+  return l;
+}
+
+status&
+operator&=(status& l, status r)
+{
+  l = l & r;
+  return l;
+}
+
+/// Return a diagnostic status with english sentences to describe the
+/// problems encoded in a given abigail::elf_reader::status, if
+/// there is an error.
+///
+/// @param status the status to diagnose
+///
+/// @return a string containing sentences that describe the possible
+/// errors encoded in @p s.  If there is no error to encode, then the
+/// empty string is returned.
+std::string
+status_to_diagnostic_string(status s)
+{
+  std::string str;
+
+  if (s & STATUS_DEBUG_INFO_NOT_FOUND)
+    str += "could not find debug info\n";
+
+  if (s & STATUS_ALT_DEBUG_INFO_NOT_FOUND)
+    str += "could not find alternate debug info\n";
+
+  if (s & STATUS_NO_SYMBOLS_FOUND)
+    str += "could not load ELF symbols\n";
+
+  return str;
+}
+
+}// end namespace elf_reader
+
+}// end namespace abigail
diff --git a/src/abg-tools-utils.cc b/src/abg-tools-utils.cc
index 2fb20c6e..cccf5316 100644
--- a/src/abg-tools-utils.cc
+++ b/src/abg-tools-utils.cc
@@ -2544,7 +2544,7 @@  build_corpus_group_from_kernel_dist_under(const string&	root,
       char *di_root_ptr = di_root.get();
       vector<char**> di_roots;
       di_roots.push_back(&di_root_ptr);
-      abigail::dwarf_reader::status status = abigail::dwarf_reader::STATUS_OK;
+      abigail::elf_reader::status status = abigail::elf_reader::STATUS_OK;
       corpus_group_sptr group;
       if (!vmlinux.empty())
 	{
diff --git a/tests/print-diff-tree.cc b/tests/print-diff-tree.cc
index 12390962..6d5ec6b2 100644
--- a/tests/print-diff-tree.cc
+++ b/tests/print-diff-tree.cc
@@ -101,7 +101,7 @@  main(int argc, char* argv[])
 
   if (!opts.elf1.empty() && !opts.elf2.empty())
     {
-      dwarf_reader::status c1_status, c2_status;
+      elf_reader::status c1_status, c2_status;
       corpus_sptr c1, c2;
 
       environment_sptr env(new environment);
@@ -109,7 +109,7 @@  main(int argc, char* argv[])
       c1 = dwarf_reader::read_corpus_from_elf(opts.elf1, di_roots, env.get(),
 					      /*load_all_types=*/false,
 					      c1_status);
-      if (c1_status != dwarf_reader::STATUS_OK)
+      if (c1_status != elf_reader::STATUS_OK)
 	{
 	  cerr << "Failed to read elf file " << opts.elf1 << "\n";
 	  return 1;
@@ -118,7 +118,7 @@  main(int argc, char* argv[])
       c2 = dwarf_reader::read_corpus_from_elf(opts.elf2, di_roots, env.get(),
 					      /*load_all_types=*/false,
 					      c2_status);
-      if (c2_status != dwarf_reader::STATUS_OK)
+      if (c2_status != elf_reader::STATUS_OK)
 	{
 	  cerr << "Failed to read elf file " << opts.elf2 << "\n";
 	  return 1;
diff --git a/tests/test-diff-dwarf.cc b/tests/test-diff-dwarf.cc
index 02ec393d..5eaf0e21 100644
--- a/tests/test-diff-dwarf.cc
+++ b/tests/test-diff-dwarf.cc
@@ -380,8 +380,8 @@  main()
 	  continue;
 	}
 
-      abigail::dwarf_reader::status status =
-	abigail::dwarf_reader::STATUS_UNKNOWN;
+      abigail::elf_reader::status status =
+	abigail::elf_reader::STATUS_UNKNOWN;
 
       environment_sptr env(new environment);
       std::vector<char**> di_roots;
diff --git a/tests/test-ir-walker.cc b/tests/test-ir-walker.cc
index ea93380f..e4247619 100644
--- a/tests/test-ir-walker.cc
+++ b/tests/test-ir-walker.cc
@@ -157,7 +157,7 @@  main(int argc, char **argv)
 
   abigail::ir::environment_sptr env(new abigail::ir::environment);
   abigail::corpus_sptr c;
-  abigail::dwarf_reader::status status = abigail::dwarf_reader::STATUS_OK;
+  abigail::elf_reader::status status = abigail::elf_reader::STATUS_OK;
   std::vector<char**> di_roots;
   if (!(c = abigail::dwarf_reader::read_corpus_from_elf(file_name, di_roots,
 							env.get(),
diff --git a/tests/test-read-dwarf.cc b/tests/test-read-dwarf.cc
index 509bc11a..726786a1 100644
--- a/tests/test-read-dwarf.cc
+++ b/tests/test-read-dwarf.cc
@@ -589,8 +589,8 @@  struct test_task : public abigail::workers::task
       in_public_headers_path = in_elf_base + spec.in_public_headers_path;
 
     env.reset(new abigail::ir::environment);
-    abigail::dwarf_reader::status status =
-    abigail::dwarf_reader::STATUS_UNKNOWN;
+    abigail::elf_reader::status status =
+    abigail::elf_reader::STATUS_UNKNOWN;
     vector<char**> di_roots;
     ABG_ASSERT(abigail::tools_utils::file_exists(in_elf_path));
     read_context_sptr ctxt = create_read_context(in_elf_path,
diff --git a/tests/test-symtab.cc b/tests/test-symtab.cc
index fd0fdd44..7d7a2df0 100644
--- a/tests/test-symtab.cc
+++ b/tests/test-symtab.cc
@@ -34,7 +34,7 @@  using suppr::suppressions_type;
 static const std::string test_data_dir =
     std::string(abigail::tests::get_src_dir()) + "/tests/data/test-symtab/";
 
-dwarf_reader::status
+elf_reader::status
 read_corpus(const std::string&		    path,
 	    corpus_sptr&		    result,
 	    const std::vector<std::string>& whitelist_paths =
@@ -58,10 +58,10 @@  read_corpus(const std::string&		    path,
       dwarf_reader::add_read_context_suppressions(*ctxt, wl_suppr);
     }
 
-  dwarf_reader::status status = dwarf_reader::STATUS_UNKNOWN;
+  elf_reader::status status = elf_reader::STATUS_UNKNOWN;
   result = read_corpus_from_elf(*ctxt, status);
 
-  REQUIRE(status != dwarf_reader::STATUS_UNKNOWN);
+  REQUIRE(status != elf_reader::STATUS_UNKNOWN);
   return status;
 }
 
@@ -69,22 +69,22 @@  TEST_CASE("Symtab::Empty", "[symtab, basic]")
 {
   const std::string	     binary = "basic/empty.so";
   corpus_sptr		     corpus_ptr;
-  const dwarf_reader::status status = read_corpus(binary, corpus_ptr);
+  const elf_reader::status status = read_corpus(binary, corpus_ptr);
   REQUIRE(!corpus_ptr);
 
-  REQUIRE((status & dwarf_reader::STATUS_NO_SYMBOLS_FOUND));
+  REQUIRE((status & elf_reader::STATUS_NO_SYMBOLS_FOUND));
 }
 
 TEST_CASE("Symtab::NoDebugInfo", "[symtab, basic]")
 {
   const std::string	     binary = "basic/no_debug_info.so";
   corpus_sptr		     corpus_ptr;
-  const dwarf_reader::status status = read_corpus(binary, corpus_ptr);
+  const elf_reader::status status = read_corpus(binary, corpus_ptr);
   REQUIRE(corpus_ptr);
 
   REQUIRE(status
-	  == (dwarf_reader::STATUS_OK
-	      | dwarf_reader::STATUS_DEBUG_INFO_NOT_FOUND));
+	  == (elf_reader::STATUS_OK
+	      | elf_reader::STATUS_DEBUG_INFO_NOT_FOUND));
 }
 
 // this value indicates in the following helper method, that we do not want to
@@ -102,11 +102,11 @@  assert_symbol_count(const std::string& path,
 			std::vector<std::string>())
 {
   corpus_sptr		     corpus_ptr;
-  const dwarf_reader::status status =
+  const elf_reader::status status =
     read_corpus(path, corpus_ptr, whitelist_paths);
   REQUIRE(corpus_ptr);
 
-  REQUIRE((status & dwarf_reader::STATUS_OK));
+  REQUIRE((status & elf_reader::STATUS_OK));
   const corpus& corpus = *corpus_ptr;
 
   size_t total_symbols = 0;
@@ -244,10 +244,10 @@  TEST_CASE("Symtab::SymtabWithWhitelist", "[symtab, whitelist]")
 	+ "basic/one_function_one_variable_irrelevant.whitelist");
 
       corpus_sptr		 corpus_ptr;
-      const dwarf_reader::status status =
+      const elf_reader::status status =
 	read_corpus(binary, corpus_ptr, whitelists);
       REQUIRE(!corpus_ptr);
-      REQUIRE((status & dwarf_reader::STATUS_NO_SYMBOLS_FOUND));
+      REQUIRE((status & elf_reader::STATUS_NO_SYMBOLS_FOUND));
     }
 
     GIVEN("we read the binary with only the function whitelisted")
diff --git a/tools/abicompat.cc b/tools/abicompat.cc
index addd03a9..a7f701fc 100644
--- a/tools/abicompat.cc
+++ b/tools/abicompat.cc
@@ -246,7 +246,7 @@  using abigail::ir::type_base_sptr;
 using abigail::ir::function_type_sptr;
 using abigail::ir::function_decl;
 using abigail::ir::var_decl;
-using abigail::dwarf_reader::status;
+using abigail::elf_reader::status;
 using abigail::dwarf_reader::read_corpus_from_elf;
 using abigail::comparison::diff_context_sptr;
 using abigail::comparison::diff_context;
@@ -696,7 +696,7 @@  main(int argc, char* argv[])
   char * app_di_root = opts.app_di_root_path.get();
   vector<char**> app_di_roots;
   app_di_roots.push_back(&app_di_root);
-  status status = abigail::dwarf_reader::STATUS_UNKNOWN;
+  status status = abigail::elf_reader::STATUS_UNKNOWN;
   environment_sptr env(new environment);
   corpus_sptr app_corpus=
     read_corpus_from_elf(opts.app_path,
@@ -704,13 +704,13 @@  main(int argc, char* argv[])
 			 /*load_all_types=*/opts.weak_mode,
 			 status);
 
-  if (status & abigail::dwarf_reader::STATUS_NO_SYMBOLS_FOUND)
+  if (status & abigail::elf_reader::STATUS_NO_SYMBOLS_FOUND)
     {
       emit_prefix(argv[0], cerr)
 	<< "could not read symbols from " << opts.app_path << "\n";
       return abigail::tools_utils::ABIDIFF_ERROR;
     }
-  if (!(status & abigail::dwarf_reader::STATUS_OK))
+  if (!(status & abigail::elf_reader::STATUS_OK))
     {
       emit_prefix(argv[0], cerr)
 	<< "could not read file " << opts.app_path << "\n";
@@ -753,15 +753,15 @@  main(int argc, char* argv[])
 						 lib1_di_roots, env.get(),
 						 /*load_all_types=*/false,
 						 status);
-  if (status & abigail::dwarf_reader::STATUS_DEBUG_INFO_NOT_FOUND)
+  if (status & abigail::elf_reader::STATUS_DEBUG_INFO_NOT_FOUND)
     emit_prefix(argv[0], cerr)
       << "could not read debug info for " << opts.lib1_path << "\n";
-  if (status & abigail::dwarf_reader::STATUS_NO_SYMBOLS_FOUND)
+  if (status & abigail::elf_reader::STATUS_NO_SYMBOLS_FOUND)
     {
       cerr << "could not read symbols from " << opts.lib1_path << "\n";
       return abigail::tools_utils::ABIDIFF_ERROR;
     }
-  if (!(status & abigail::dwarf_reader::STATUS_OK))
+  if (!(status & abigail::elf_reader::STATUS_OK))
     {
       emit_prefix(argv[0], cerr)
 	<< "could not read file " << opts.lib1_path << "\n";
@@ -780,16 +780,16 @@  main(int argc, char* argv[])
 					 lib2_di_roots, env.get(),
 					 /*load_all_types=*/false,
 					 status);
-      if (status & abigail::dwarf_reader::STATUS_DEBUG_INFO_NOT_FOUND)
+      if (status & abigail::elf_reader::STATUS_DEBUG_INFO_NOT_FOUND)
 	emit_prefix(argv[0], cerr)
 	  << "could not read debug info for " << opts.lib2_path << "\n";
-      if (status & abigail::dwarf_reader::STATUS_NO_SYMBOLS_FOUND)
+      if (status & abigail::elf_reader::STATUS_NO_SYMBOLS_FOUND)
 	{
 	  emit_prefix(argv[0], cerr)
 	    << "could not read symbols from " << opts.lib2_path << "\n";
 	  return abigail::tools_utils::ABIDIFF_ERROR;
 	}
-      if (!(status & abigail::dwarf_reader::STATUS_OK))
+      if (!(status & abigail::elf_reader::STATUS_OK))
 	{
 	  emit_prefix(argv[0], cerr)
 	    << "could not read file " << opts.lib2_path << "\n";
diff --git a/tools/abidiff.cc b/tools/abidiff.cc
index 56f57448..157d192f 100644
--- a/tools/abidiff.cc
+++ b/tools/abidiff.cc
@@ -45,6 +45,7 @@  using abigail::suppr::suppression_sptr;
 using abigail::suppr::suppressions_type;
 using abigail::suppr::read_suppressions;
 using namespace abigail::dwarf_reader;
+using namespace abigail::elf_reader;
 using abigail::tools_utils::emit_prefix;
 using abigail::tools_utils::check_file;
 using abigail::tools_utils::guess_file_type;
@@ -945,17 +946,17 @@  prepare_di_root_paths(options& o)
 /// @return abigail::tools_utils::ABIDIFF_ERROR if an error was
 /// detected, abigail::tools_utils::ABIDIFF_OK otherwise.
 static abigail::tools_utils::abidiff_status
-handle_error(abigail::dwarf_reader::status status_code,
+handle_error(abigail::elf_reader::status status_code,
 	     const abigail::dwarf_reader::read_context* ctxt,
 	     const string& prog_name,
 	     const options& opts)
 {
-  if (!(status_code & abigail::dwarf_reader::STATUS_OK))
+  if (!(status_code & abigail::elf_reader::STATUS_OK))
     {
       emit_prefix(prog_name, cerr)
 	<< "failed to read input file " << opts.file1 << "\n";
 
-      if (status_code & abigail::dwarf_reader::STATUS_DEBUG_INFO_NOT_FOUND)
+      if (status_code & abigail::elf_reader::STATUS_DEBUG_INFO_NOT_FOUND)
 	{
 	  emit_prefix(prog_name, cerr) <<
 	    "could not find the debug info\n";
@@ -1008,7 +1009,7 @@  handle_error(abigail::dwarf_reader::status status_code,
 	  }
 	}
 
-      if (status_code & abigail::dwarf_reader::STATUS_ALT_DEBUG_INFO_NOT_FOUND)
+      if (status_code & abigail::elf_reader::STATUS_ALT_DEBUG_INFO_NOT_FOUND)
 	{
 	  emit_prefix(prog_name, cerr)
 	    << "could not find the alternate debug info file";
@@ -1023,7 +1024,7 @@  handle_error(abigail::dwarf_reader::status status_code,
 	  cerr << "\n";
 	}
 
-      if (status_code & abigail::dwarf_reader::STATUS_NO_SYMBOLS_FOUND)
+      if (status_code & abigail::elf_reader::STATUS_NO_SYMBOLS_FOUND)
 	emit_prefix(prog_name, cerr)
 	  << "could not find the ELF symbols in the file '"
 	  << opts.file1
@@ -1132,9 +1133,9 @@  main(int argc, char* argv[])
 	      env->self_comparison_debug_is_on(true);
 #endif
       translation_unit_sptr t1, t2;
-      abigail::dwarf_reader::status c1_status =
-	abigail::dwarf_reader::STATUS_OK,
-	c2_status = abigail::dwarf_reader::STATUS_OK;
+      abigail::elf_reader::status c1_status =
+	abigail::elf_reader::STATUS_OK,
+	c2_status = abigail::elf_reader::STATUS_OK;
       corpus_sptr c1, c2;
       corpus_group_sptr g1, g2;
       bool files_suppressed = false;
diff --git a/tools/abidw.cc b/tools/abidw.cc
index 240ed095..beb2fa0f 100644
--- a/tools/abidw.cc
+++ b/tools/abidw.cc
@@ -519,7 +519,7 @@  load_corpus_and_write_abixml(char* argv[],
 
   read_context& ctxt = *context;
   corpus_sptr corp;
-  dwarf_reader::status s = dwarf_reader::STATUS_UNKNOWN;
+  elf_reader::status s = elf_reader::STATUS_UNKNOWN;
   t.start();
   corp = read_corpus_from_elf(ctxt, s);
   t.stop();
@@ -537,7 +537,7 @@  load_corpus_and_write_abixml(char* argv[],
 
   if (!corp)
     {
-      if (s == dwarf_reader::STATUS_DEBUG_INFO_NOT_FOUND)
+      if (s == elf_reader::STATUS_DEBUG_INFO_NOT_FOUND)
 	{
 	  if (opts.di_root_paths.empty())
 	    {
@@ -567,7 +567,7 @@  load_corpus_and_write_abixml(char* argv[],
 		}
 	    }
 	}
-      else if (s == dwarf_reader::STATUS_NO_SYMBOLS_FOUND)
+      else if (s == elf_reader::STATUS_NO_SYMBOLS_FOUND)
 	emit_prefix(argv[0], cerr)
 	  << "Could not read ELF symbol information from "
 	  << opts.in_file_path << "\n";
@@ -885,11 +885,11 @@  main(int argc, char* argv[])
 	{
 	  bool has_alt_di = false;
 	  string alt_di_path;
-	  abigail::dwarf_reader::status status =
+	  abigail::elf_reader::status status =
 	    abigail::dwarf_reader::has_alt_debug_info(ctxt,
 						      has_alt_di,
 						      alt_di_path);
-	  if (status & abigail::dwarf_reader::STATUS_OK)
+	  if (status & abigail::elf_reader::STATUS_OK)
 	    {
 	      if (alt_di_path.empty())
 		;
diff --git a/tools/abilint.cc b/tools/abilint.cc
index 01308eb4..d8c44f82 100644
--- a/tools/abilint.cc
+++ b/tools/abilint.cc
@@ -346,7 +346,7 @@  main(int argc, char* argv[])
       abigail::translation_unit_sptr tu;
       abigail::corpus_sptr corp;
       abigail::corpus_group_sptr group;
-      abigail::dwarf_reader::status s = abigail::dwarf_reader::STATUS_OK;
+      abigail::elf_reader::status s = abigail::elf_reader::STATUS_OK;
       char* di_root_path = 0;
       file_type type = guess_file_type(opts.file_path);
 
@@ -426,9 +426,9 @@  main(int argc, char* argv[])
 	{
 	  emit_prefix(argv[0], cerr)
 	    << "failed to read " << opts.file_path << "\n";
-	  if (!(s & abigail::dwarf_reader::STATUS_OK))
+	  if (!(s & abigail::elf_reader::STATUS_OK))
 	    {
-	      if (s & abigail::dwarf_reader::STATUS_DEBUG_INFO_NOT_FOUND)
+	      if (s & abigail::elf_reader::STATUS_DEBUG_INFO_NOT_FOUND)
 		{
 		  cerr << "could not find the debug info";
 		  if(di_root_path == 0)
@@ -442,7 +442,7 @@  main(int argc, char* argv[])
 		      << "Maybe the root path to the debug "
 		      "information is wrong?\n";
 		}
-	      if (s & abigail::dwarf_reader::STATUS_NO_SYMBOLS_FOUND)
+	      if (s & abigail::elf_reader::STATUS_NO_SYMBOLS_FOUND)
 		emit_prefix(argv[0], cerr)
 		  << "could not find the ELF symbols in the file "
 		  << opts.file_path
diff --git a/tools/abipkgdiff.cc b/tools/abipkgdiff.cc
index f90d5cb0..33efa23a 100644
--- a/tools/abipkgdiff.cc
+++ b/tools/abipkgdiff.cc
@@ -1231,7 +1231,7 @@  set_diff_context_from_opts(diff_context_sptr ctxt,
 ///
 /// @param detailed_error_status is this pointer is non-null and if
 /// the function returns ABIDIFF_ERROR, then the function sets the
-/// pointed-to parameter to the abigail::dwarf_reader::status value
+/// pointed-to parameter to the abigail::elf_reader::status value
 /// that gives details about the rror.
 ///
 /// @return the status of the comparison.
@@ -1246,7 +1246,7 @@  compare(const elf_file& elf1,
 	abigail::ir::environment_sptr	&env,
 	corpus_diff_sptr	&diff,
 	diff_context_sptr	&ctxt,
-	abigail::dwarf_reader::status *detailed_error_status = 0)
+	abigail::elf_reader::status *detailed_error_status = 0)
 {
   char *di_dir1 = (char*) debug_dir1.c_str(),
 	*di_dir2 = (char*) debug_dir2.c_str();
@@ -1263,8 +1263,8 @@  compare(const elf_file& elf1,
       << elf2.path
       << "...\n";
 
-  abigail::dwarf_reader::status c1_status = abigail::dwarf_reader::STATUS_OK,
-    c2_status = abigail::dwarf_reader::STATUS_OK;
+  abigail::elf_reader::status c1_status = abigail::elf_reader::STATUS_OK,
+    c2_status = abigail::elf_reader::STATUS_OK;
 
   ctxt.reset(new diff_context);
   set_diff_context_from_opts(ctxt, opts);
@@ -1315,7 +1315,7 @@  compare(const elf_file& elf1,
     corpus1 = read_corpus_from_elf(*c, c1_status);
 
     bool bail_out = false;
-    if (!(c1_status & abigail::dwarf_reader::STATUS_OK))
+    if (!(c1_status & abigail::elf_reader::STATUS_OK))
       {
 	if (opts.verbose)
 	  emit_prefix("abipkgdiff", cerr)
@@ -1332,7 +1332,7 @@  compare(const elf_file& elf1,
     if (opts.fail_if_no_debug_info)
       {
 	bool debug_info_error = false;
-	if (c1_status & abigail::dwarf_reader::STATUS_DEBUG_INFO_NOT_FOUND)
+	if (c1_status & abigail::elf_reader::STATUS_DEBUG_INFO_NOT_FOUND)
 	  {
 	    if (opts.verbose)
 	      emit_prefix("abipkgdiff", cerr)
@@ -1349,7 +1349,7 @@  compare(const elf_file& elf1,
 	    debug_info_error = true;
 	  }
 
-	if (c1_status & abigail::dwarf_reader::STATUS_ALT_DEBUG_INFO_NOT_FOUND)
+	if (c1_status & abigail::elf_reader::STATUS_ALT_DEBUG_INFO_NOT_FOUND)
 	  {
 	    if (opts.verbose)
 	      emit_prefix("abipkgdiff", cerr)
@@ -1402,7 +1402,7 @@  compare(const elf_file& elf1,
     corpus2 = read_corpus_from_elf(*c, c2_status);
 
     bool bail_out = false;
-    if (!(c2_status & abigail::dwarf_reader::STATUS_OK))
+    if (!(c2_status & abigail::elf_reader::STATUS_OK))
       {
 	if (opts.verbose)
 	  emit_prefix("abipkgdiff", cerr)
@@ -1419,7 +1419,7 @@  compare(const elf_file& elf1,
     if (opts.fail_if_no_debug_info)
       {
 	bool debug_info_error = false;
-	if (c2_status & abigail::dwarf_reader::STATUS_DEBUG_INFO_NOT_FOUND)
+	if (c2_status & abigail::elf_reader::STATUS_DEBUG_INFO_NOT_FOUND)
 	  {
 	    if (opts.verbose)
 	      emit_prefix("abipkgdiff", cerr)
@@ -1436,7 +1436,7 @@  compare(const elf_file& elf1,
 	    debug_info_error = true;
 	  }
 
-	if (c2_status & abigail::dwarf_reader::STATUS_ALT_DEBUG_INFO_NOT_FOUND)
+	if (c2_status & abigail::elf_reader::STATUS_ALT_DEBUG_INFO_NOT_FOUND)
 	  {
 	    if (opts.verbose)
 	      emit_prefix("abipkgdiff", cerr)
@@ -1520,14 +1520,14 @@  compare_to_self(const elf_file& elf,
 		abigail::ir::environment_sptr	&env,
 		corpus_diff_sptr	&diff,
 		diff_context_sptr	&ctxt,
-		abigail::dwarf_reader::status *detailed_error_status = 0)
+		abigail::elf_reader::status *detailed_error_status = 0)
 {
   char *di_dir = (char*) debug_dir.c_str();
 
   vector<char**> di_dirs;
   di_dirs.push_back(&di_dir);
 
-  abigail::dwarf_reader::status c_status = abigail::dwarf_reader::STATUS_OK;
+  abigail::elf_reader::status c_status = abigail::elf_reader::STATUS_OK;
 
   if (opts.verbose)
     emit_prefix("abipkgdiff", cerr)
@@ -1549,7 +1549,7 @@  compare_to_self(const elf_file& elf,
 
     corp = read_corpus_from_elf(*c, c_status);
 
-    if (!(c_status & abigail::dwarf_reader::STATUS_OK))
+    if (!(c_status & abigail::elf_reader::STATUS_OK))
       {
 	if (opts.verbose)
 	  emit_prefix("abipkgdiff", cerr)
@@ -2000,8 +2000,8 @@  public:
     diff_context_sptr ctxt;
     corpus_diff_sptr diff;
 
-    abigail::dwarf_reader::status detailed_status =
-      abigail::dwarf_reader::STATUS_UNKNOWN;
+    abigail::elf_reader::status detailed_status =
+      abigail::elf_reader::STATUS_UNKNOWN;
 
     status |= compare(args->elf1, args->debug_dir1, args->private_types_suppr1,
 		      args->elf2, args->debug_dir2, args->private_types_suppr2,
@@ -2031,7 +2031,7 @@  public:
     if (status & abigail::tools_utils::ABIDIFF_ERROR)
       {
 	string diagnostic =
-	  abigail::dwarf_reader::status_to_diagnostic_string(detailed_status);
+	  abigail::elf_reader::status_to_diagnostic_string(detailed_status);
 	if (diagnostic.empty())
 	  diagnostic =
 	    "Unknown error.  Please run the tool again with --verbose\n";
@@ -2069,8 +2069,8 @@  public:
     diff_context_sptr ctxt;
     corpus_diff_sptr diff;
 
-    abigail::dwarf_reader::status detailed_status =
-      abigail::dwarf_reader::STATUS_UNKNOWN;
+    abigail::elf_reader::status detailed_status =
+      abigail::elf_reader::STATUS_UNKNOWN;
 
     status |= compare_to_self(args->elf1, args->debug_dir1,
 			      args->opts, env, diff, ctxt,
@@ -2097,7 +2097,7 @@  public:
     if (status & abigail::tools_utils::ABIDIFF_ERROR)
       {
 	string diagnostic =
-	  abigail::dwarf_reader::status_to_diagnostic_string(detailed_status);
+	  abigail::elf_reader::status_to_diagnostic_string(detailed_status);
 
 	if (diagnostic.empty())
 	  diagnostic =