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 2/2] dwarf-reader: read_context: drop unused symbol versioning code
Date: Mon, 18 May 2020 13:45:36 +0200 [thread overview]
Message-ID: <20200518114536.202504-2-maennich@google.com> (raw)
In-Reply-To: <20200518114536.202504-1-maennich@google.com>
Since the symbol versioning helper code has been moved to elf_helpers in
commit 9815efe7a5be ("abg-elf-helpers: move some versioning helpers
from abg-dwarf-reader"), remove the leftover unused code from
read_context.
* src/abg-dwarf-reader.cc
(read_context::versym_section_): Delete.
(read_context::verdef_section_): Delete.
(read_context::verneed_section_): Delete.
(read_context::symbol_versionning_sections_loaded_): Delete.
(read_context::symbol_versionning_sections_found_): Delete.
(read_context::initialize): Remove initializations of deleted members.
(read_context::get_symbol_versionning_sections): Delete.
(read_context::get_version_for_symbol): Delete.
(read_context::lookup_elf_symbol_from_index): Use
get_version_for_symbol provided by elf_helpers.
Signed-off-by: Matthias Maennich <maennich@google.com>
---
src/abg-dwarf-reader.cc | 119 +---------------------------------------
1 file changed, 2 insertions(+), 117 deletions(-)
diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc
index ab1a01cb3aa0..621e00e00a9d 100644
--- a/src/abg-dwarf-reader.cc
+++ b/src/abg-dwarf-reader.cc
@@ -2184,11 +2184,6 @@ public:
mutable Elf_Scn* ksymtab_gpl_section_;
mutable Elf_Scn* ksymtab_gpl_reloc_section_;
mutable Elf_Scn* ksymtab_strings_section_;
- Elf_Scn* versym_section_;
- Elf_Scn* verdef_section_;
- Elf_Scn* verneed_section_;
- bool symbol_versionning_sections_loaded_;
- bool symbol_versionning_sections_found_;
Dwarf_Die* cur_tu_die_;
mutable dwarf_expr_eval_context dwarf_expr_eval_context_;
// A set of maps (one per kind of die source) that associates a decl
@@ -2379,11 +2374,6 @@ public:
ksymtab_gpl_section_ = 0;
ksymtab_gpl_reloc_section_ = 0;
ksymtab_strings_section_ = 0;
- versym_section_ = 0;
- verdef_section_ = 0;
- verneed_section_ = 0;
- symbol_versionning_sections_loaded_ = 0;
- symbol_versionning_sections_found_ = 0;
cur_tu_die_ = 0;
exported_decls_builder_ = 0;
@@ -5173,110 +5163,6 @@ public:
return result;
}
- /// Return the SHT_GNU_versym, SHT_GNU_verdef and SHT_GNU_verneed
- /// sections that are involved in symbol versionning.
- ///
- /// @param versym_section the SHT_GNU_versym section found.
- ///
- /// @param verdef_section the SHT_GNU_verdef section found.
- ///
- /// @param verneed_section the SHT_GNU_verneed section found.
- ///
- /// @return true iff the sections where found.
- bool
- get_symbol_versionning_sections(Elf_Scn*& versym_section,
- Elf_Scn*& verdef_section,
- Elf_Scn*& verneed_section)
- {
- if (!symbol_versionning_sections_loaded_)
- {
- symbol_versionning_sections_found_ =
- dwarf_reader::get_symbol_versionning_sections(elf_handle(),
- versym_section_,
- verdef_section_,
- verneed_section_);
- symbol_versionning_sections_loaded_ = true;
- }
-
- versym_section = versym_section_;
- verdef_section = verdef_section_;
- verneed_section = verneed_section_;
- return symbol_versionning_sections_found_;
- }
-
- /// Return the version for a symbol that is at a given index in its
- /// SHT_SYMTAB section.
- ///
- /// The first invocation of this function caches the results and
- /// subsequent invocations just return the cached results.
- ///
- /// @param symbol_index the index of the symbol to consider.
- ///
- /// @param get_def_version if this is true, it means that that we want
- /// the version for a defined symbol; in that case, the version is
- /// looked for in a section of type SHT_GNU_verdef. Otherwise, if
- /// this parameter is false, this means that we want the version for
- /// an undefined symbol; in that case, the version is the needed one
- /// for the symbol to be resolved; so the version is looked fo in a
- /// section of type SHT_GNU_verneed.
- ///
- /// @param version the version found for symbol at @p symbol_index.
- ///
- /// @return true iff a version was found for symbol at index @p
- /// symbol_index.
- bool
- get_version_for_symbol(size_t symbol_index,
- bool get_def_version,
- elf_symbol::version& version)
- {
- Elf_Scn *versym_section = NULL,
- *verdef_section = NULL,
- *verneed_section = NULL;
-
- if (!get_symbol_versionning_sections(versym_section,
- verdef_section,
- verneed_section))
- return false;
-
- GElf_Versym versym_mem;
- Elf_Data* versym_data = (versym_section)
- ? elf_getdata(versym_section, NULL)
- : NULL;
- GElf_Versym* versym = (versym_data)
- ? gelf_getversym(versym_data, symbol_index, &versym_mem)
- : NULL;
-
- if (versym == 0 || *versym <= 1)
- // I got these value from the code of readelf.c in elfutils.
- // Apparently, if the symbol version entry has these values, the
- // symbol must be discarded. This is not documented in the
- // official specification.
- return false;
-
- if (get_def_version)
- {
- if (*versym == 0x8001)
- // I got this value from the code of readelf.c in elfutils
- // too. It's not really documented in the official
- // specification.
- return false;
-
- if (verdef_section
- && get_version_definition_for_versym(elf_handle(), versym,
- verdef_section, version))
- return true;
- }
- else
- {
- if (verneed_section
- && get_version_needed_for_versym(elf_handle(), versym,
- verneed_section, version))
- return true;
- }
-
- return false;
- }
-
/// Lookup an elf symbol, referred to by its index, from the .symtab
/// section.
///
@@ -5366,9 +5252,8 @@ public:
name_str = "";
elf_symbol::version ver;
- get_version_for_symbol(symbol_index,
- sym_is_defined,
- ver);
+ elf_helpers::get_version_for_symbol(elf_handle(), symbol_index,
+ sym_is_defined, ver);
elf_symbol::visibility vis =
stv_to_elf_symbol_visibility(GELF_ST_VISIBILITY(native_sym.st_other));
--
2.26.2.761.g0e0b3e54be-goog
next prev parent reply other threads:[~2020-05-18 11:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-18 11:45 [PATCH 1/2] dwarf-reader: Remove unused code Matthias Maennich
2020-05-18 11:45 ` Matthias Maennich [this message]
2020-06-10 16:02 ` [PATCH 2/2] dwarf-reader: read_context: drop unused symbol versioning code Dodji Seketeli
2020-06-10 16:01 ` [PATCH 1/2] dwarf-reader: Remove unused code 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=20200518114536.202504-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).