public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
From: Matthias Maennich <maennich@google.com>
To: libabigail@sourceware.org
Cc: dodji@seketeli.org, gprocida@google.com, kernel-team@android.com,
	 maennich@google.com
Subject: [PATCH 1/8] abg-dwarf-reader split: create abg-elf-helpers.{h, cc} and test case
Date: Mon, 20 Apr 2020 13:08:39 +0200	[thread overview]
Message-ID: <20200420110846.218792-2-maennich@google.com> (raw)
In-Reply-To: <20200420110846.218792-1-maennich@google.com>

abg-elf-helpers.{h,cc} shall contain the ELF related parts of the
abg-dwarf-reader. Create the stub files, an empty unit test and hook
everything up in the make system.

    * src/Makefile.am: Add new source files abg-elf-helpers.{h,cc}.
    * src/abg-elf-helpers.cc: New source file.
    * src/abg-elf-helpers.h: New header file.
    * tests/.gitignore: Exclude runtestelfhelpers from being committed.
    * tests/Makefile.am: Add new test case runtestelfhelpers.
    * tests/test-elf-helpers.cc: New test source file.

Signed-off-by: Matthias Maennich <maennich@google.com>
---
 src/Makefile.am           |  2 ++
 src/abg-elf-helpers.cc    | 34 ++++++++++++++++++++++++++++++++++
 src/abg-elf-helpers.h     | 37 +++++++++++++++++++++++++++++++++++++
 tests/.gitignore          |  1 +
 tests/Makefile.am         |  6 +++++-
 tests/test-elf-helpers.cc | 30 ++++++++++++++++++++++++++++++
 6 files changed, 109 insertions(+), 1 deletion(-)
 create mode 100644 src/abg-elf-helpers.cc
 create mode 100644 src/abg-elf-helpers.h
 create mode 100644 tests/test-elf-helpers.cc

diff --git a/src/Makefile.am b/src/Makefile.am
index 1d0e2dcecdee..fafab853b520 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -39,6 +39,8 @@ abg-config.cc				\
 abg-ini.cc				\
 abg-workers.cc				\
 abg-tools-utils.cc			\
+abg-elf-helpers.h			\
+abg-elf-helpers.cc			\
 $(CXX11_SOURCES)
 
 libabigail_la_LIBADD = $(DEPS_LIBS)
diff --git a/src/abg-elf-helpers.cc b/src/abg-elf-helpers.cc
new file mode 100644
index 000000000000..e99fe4a5c306
--- /dev/null
+++ b/src/abg-elf-helpers.cc
@@ -0,0 +1,34 @@
+// -*- Mode: C++ -*-
+//
+// Copyright (C) 2020 Google, Inc.
+//
+// This file is part of the GNU Application Binary Interface Generic
+// Analysis and Instrumentation Library (libabigail).  This library is
+// free software; you can redistribute it and/or modify it under the
+// terms of the GNU Lesser General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option) any
+// later version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Lesser Public License for more details.
+
+// You should have received a copy of the GNU Lesser General Public
+// License along with this program; see the file COPYING-LGPLV3.  If
+// not, see <http://www.gnu.org/licenses/>.
+
+/// @file
+///
+/// This contains the definitions of the ELF utilities for the dwarf reader.
+
+#include "abg-elf-helpers.h"
+
+namespace abigail
+{
+
+namespace elf_helpers
+{
+
+} // end namespace elf_helpers
+} // end namespace abigail
diff --git a/src/abg-elf-helpers.h b/src/abg-elf-helpers.h
new file mode 100644
index 000000000000..bffa46cc3c2d
--- /dev/null
+++ b/src/abg-elf-helpers.h
@@ -0,0 +1,37 @@
+// -*- Mode: C++ -*-
+//
+// Copyright (C) 2020 Google, Inc.
+//
+// This file is part of the GNU Application Binary Interface Generic
+// Analysis and Instrumentation Library (libabigail).  This library is
+// free software; you can redistribute it and/or modify it under the
+// terms of the GNU Lesser General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option) any
+// later version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Lesser Public License for more details.
+
+// You should have received a copy of the GNU Lesser General Public
+// License along with this program; see the file COPYING-LGPLV3.  If
+// not, see <http://www.gnu.org/licenses/>.
+
+/// @file
+///
+/// This contains a set of ELF utilities used by the dwarf reader.
+
+#ifndef __ABG_ELF_HELPERS_H__
+#define __ABG_ELF_HELPERS_H__
+
+namespace abigail
+{
+
+namespace elf_helpers
+{
+
+} // end namespace elf_helpers
+} // end namespace abigail
+
+#endif // __ABG_ELF_HELPERS_H__
diff --git a/tests/.gitignore b/tests/.gitignore
index f05e295db260..ebe7b9cc9e13 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -22,6 +22,7 @@ runtestdiffdwarfabixml
 runtestdifffilter
 runtestdiffpkg
 runtestdiffsuppr
+runtestelfhelpers
 runtestini
 runtestkmiwhitelist
 runtestlookupsyms
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 823e0db50c37..c1b187051377 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -46,6 +46,7 @@ runtestabidiffexit		\
 runtestini			\
 runtesttoolsutils		\
 runtestkmiwhitelist		\
+runtestelfhelpers		\
 $(CXX11_TESTS)
 
 if ENABLE_RUNNING_TESTS_WITH_PY3
@@ -142,6 +143,9 @@ runtesttoolsutils_LDADD = libtestutils.la $(top_builddir)/src/libabigail.la
 runtestkmiwhitelist_SOURCES = test-kmi-whitelist.cc
 runtestkmiwhitelist_LDADD = libtestutils.la libcatch.la $(top_builddir)/src/libabigail.la
 
+runtestelfhelpers_SOURCES = test-elf-helpers.cc
+runtestelfhelpers_LDADD = libcatch.la $(top_builddir)/src/libabigail.la
+
 runtestsvg_SOURCES=test-svg.cc
 runtestsvg_LDADD=$(top_builddir)/src/libabigail.la
 
@@ -172,7 +176,7 @@ runtestfedabipkgdiffpy3.sh$(EXEEXT):
 runtestdefaultsupprspy3_sh_SOURCES =
 runtestdefaultsupprspy3.sh$(EXEEXT):
 
-AM_CPPFLAGS=-I${abs_top_srcdir}/include \
+AM_CPPFLAGS=-I${abs_top_srcdir}/include -I${abs_top_srcdir}/src \
 -I${abs_top_builddir}/include -I${abs_top_srcdir}/tools -fPIC
 
 clean-local: clean-local-check
diff --git a/tests/test-elf-helpers.cc b/tests/test-elf-helpers.cc
new file mode 100644
index 000000000000..1b36ee2f122a
--- /dev/null
+++ b/tests/test-elf-helpers.cc
@@ -0,0 +1,30 @@
+// -*- Mode: C++ -*-
+//
+// Copyright (C) 2020 Google, Inc.
+//
+// This file is part of the GNU Application Binary Interface Generic
+// Analysis and Instrumentation Library (libabigail).  This library is
+// free software; you can redistribute it and/or modify it under the
+// terms of the GNU Lesser General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option) any
+// later version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Lesser Public License for more details.
+
+// You should have received a copy of the GNU Lesser General Public
+// License along with this program; see the file COPYING-LGPLV3.  If
+// not, see <http://www.gnu.org/licenses/>.
+
+// Author: Matthias Maennich
+
+/// @file
+///
+/// This program tests libabigail's ELF helpers.
+
+#include "lib/catch.hpp"
+
+#include "abg-elf-helpers.h"
+
-- 
2.26.1.301.g55bc3eb7cb9-goog


  reply	other threads:[~2020-04-20 11:09 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-20 11:08 [PATCH 0/8] Refactor dwarf-reader: split out ELF helpers Matthias Maennich
2020-04-20 11:08 ` Matthias Maennich [this message]
2020-04-20 15:35   ` [PATCH 1/8] abg-dwarf-reader split: create abg-elf-helpers.{h, cc} and test case Giuliano Procida
2020-04-20 11:08 ` [PATCH 2/8] abg-elf-helpers: move some elf helpers from abg-dwarf-reader Matthias Maennich
2020-04-20 15:34   ` Giuliano Procida
2020-04-20 11:08 ` [PATCH 3/8] abg-elf-helpers: move some versioning " Matthias Maennich
2020-04-20 15:33   ` Giuliano Procida
2020-04-20 11:08 ` [PATCH 4/8] abg-elf-helpers: move some kernel " Matthias Maennich
2020-04-20 14:32   ` Giuliano Procida
2020-04-20 15:30     ` Giuliano Procida
2020-04-20 11:08 ` [PATCH 5/8] abg-elf-helpers: consolidate the is_linux_kernel* helpers Matthias Maennich
2020-04-20 15:29   ` Giuliano Procida
2020-04-20 11:08 ` [PATCH 6/8] abg-dwarf-reader: migrate more ELF helpers to elf-helpers Matthias Maennich
2020-04-20 15:24   ` Giuliano Procida
2020-04-21  6:14     ` Matthias Maennich
2020-04-21 11:02       ` Giuliano Procida
2020-04-20 11:08 ` [PATCH 7/8] abg-elf-helpers: migrate more elf helpers (architecture specific helpers) Matthias Maennich
2020-04-20 15:25   ` Giuliano Procida
2020-04-20 11:08 ` [PATCH 8/8] abg-elf-helpers: migrate maybe_adjust_et_rel_sym_addr_to_abs_addr Matthias Maennich
2020-04-21  6:35 ` [PATCH v2 0/8] Refactor dwarf-reader: split out ELF helpers Matthias Maennich
2020-04-21  6:35   ` [PATCH v2 1/8] abg-dwarf-reader split: create abg-elf-helpers.{h, cc} and test case Matthias Maennich
2020-04-22  9:42     ` Dodji Seketeli
2020-04-21  6:35   ` [PATCH v2 2/8] abg-elf-helpers: move some elf helpers from abg-dwarf-reader Matthias Maennich
2020-04-22  9:44     ` Dodji Seketeli
2020-04-21  6:35   ` [PATCH v2 3/8] abg-elf-helpers: move some versioning " Matthias Maennich
2020-04-22  9:46     ` Dodji Seketeli
2020-04-21  6:35   ` [PATCH v2 4/8] abg-elf-helpers: move some kernel " Matthias Maennich
2020-04-22  9:47     ` Dodji Seketeli
2020-04-21  6:35   ` [PATCH v2 5/8] abg-elf-helpers: consolidate the is_linux_kernel* helpers Matthias Maennich
2020-04-22  9:48     ` Dodji Seketeli
2020-04-21  6:35   ` [PATCH v2 6/8] abg-dwarf-reader: migrate more ELF helpers to elf-helpers Matthias Maennich
2020-04-22  9:53     ` Dodji Seketeli
2020-04-21  6:35   ` [PATCH v2 7/8] abg-elf-helpers: migrate more elf helpers (architecture specific helpers) Matthias Maennich
2020-04-22  9:55     ` Dodji Seketeli
2020-04-21  6:35   ` [PATCH v2 8/8] abg-elf-helpers: migrate maybe_adjust_et_rel_sym_addr_to_abs_addr Matthias Maennich
2020-04-22  9:56     ` Dodji Seketeli
2020-04-22  9:57   ` [PATCH v2 0/8] Refactor dwarf-reader: split out ELF helpers Dodji Seketeli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200420110846.218792-2-maennich@google.com \
    --to=maennich@google.com \
    --cc=dodji@seketeli.org \
    --cc=gprocida@google.com \
    --cc=kernel-team@android.com \
    --cc=libabigail@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).