From patchwork Tue Apr 21 06:35:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Matthias_M=C3=A4nnich?= X-Patchwork-Id: 39107 From: maennich@google.com (Matthias Maennich) Date: Tue, 21 Apr 2020 08:35:43 +0200 Subject: [PATCH v2 0/8] Refactor dwarf-reader: split out ELF helpers In-Reply-To: <20200420110846.218792-1-maennich@google.com> References: <20200420110846.218792-1-maennich@google.com> Message-ID: <20200421063551.222511-1-maennich@google.com> The abg-dwarf-reader.cc has grown into a large compilation unit with a lot of responsibilities. This does not only affect the compilation time, but also readability of the various implementation details. Hence it makes sense to attempt a refactoring of parts of it. To overcome the above and as a preparation for my future work on the symtab reading part, this splits out functionality from the dwarf reader into a new set of source files: src/elf-helpers.{h,cc} along with a test that so far only serves the purpose of ensuring that the header file can be compiled on its own. The elf-helpers, sensibly not named elf-utils, contain functionality like looking up sections, converting values or deducting information and properties in some way from an Elf* handle. They are not exposed to libabigail users as they are an implementation detail of libabigail. This set of changes is only a refactoring with minor cleanups and renames and any change to the functionality would be unintentional. Cheers, Matthias --- v2: Address Giuliano's comments. (Thanks!) Mostly reworking the commit messages. Matthias Maennich (8): abg-dwarf-reader split: create abg-elf-helpers.{h,cc} and test case abg-elf-helpers: move some elf helpers from abg-dwarf-reader abg-elf-helpers: move some versioning helpers from abg-dwarf-reader abg-elf-helpers: move some kernel helpers from abg-dwarf-reader abg-elf-helpers: consolidate the is_linux_kernel* helpers abg-dwarf-reader: migrate more ELF helpers to elf-helpers abg-elf-helpers: migrate more elf helpers (architecture specific helpers) abg-elf-helpers: migrate maybe_adjust_et_rel_sym_addr_to_abs_addr src/Makefile.am | 2 + src/abg-dwarf-reader.cc | 1209 ++----------------------------------- src/abg-elf-helpers.cc | 1031 +++++++++++++++++++++++++++++++ src/abg-elf-helpers.h | 183 ++++++ tests/.gitignore | 1 + tests/Makefile.am | 6 +- tests/test-elf-helpers.cc | 30 + 7 files changed, 1295 insertions(+), 1167 deletions(-) create mode 100644 src/abg-elf-helpers.cc create mode 100644 src/abg-elf-helpers.h create mode 100644 tests/test-elf-helpers.cc