]> sourceware.org Git - libabigail.git/commit
Support reading undefined symbols from an ELF file
authorDodji Seketeli <dodji@redhat.com>
Sun, 30 Nov 2014 10:16:28 +0000 (11:16 +0100)
committerDodji Seketeli <dodji@redhat.com>
Sun, 30 Nov 2014 18:57:05 +0000 (19:57 +0100)
commit06279598c8431e1cf8f0b8057c7711924114c712
treea1e3021d70c2fc6c6d8657fab6080cd80435f410
parent0b5edf13d78f3e62d184112742e2154df7cd2993
Support reading undefined symbols from an ELF file

In preparation to support the upcoming 'abicompat' tool, we need the
ABI corpus type to capture the symbols that are undefined in a given
ELF file.

This patch changes the ELF reader to capture the undefined symbols as
well as the symbol versions they need to be satisfied.  These
undefined symbols are then stored in the instance ABI corpus build as
a result of the reading of the ELF file.

At the moment, these undefined symbols are not serialized to the
native XML format of libabigail yet.  I guess I'll do that in a
subsequent patch.

* include/abg-corpus.h (corpus::{set_undefined_fun_symbol_map,
set_undefined_var_symbol_map, get_undefined_fun_symbol_map_sptr,
get_undefined_fun_symbol_map, get_sorted_undefined_fun_symbols,
get_undefined_var_symbol_map_sptr, get_undefined_var_symbol_map,
get_sorted_undefined_var_symbols}): Declare new methods ...
* src/abg-corpus.cc (corpus::{set_undefined_fun_symbol_map,
set_undefined_var_symbol_map, get_undefined_fun_symbol_map_sptr,
get_undefined_fun_symbol_map, get_sorted_undefined_fun_symbols,
get_undefined_var_symbol_map_sptr, get_undefined_var_symbol_map,
get_sorted_undefined_var_symbols}): ... and define them.
(struct corpus::priv::{undefined_var_symbol_map,
sorted_undefined_var_symbols, undefined_fun_symbol_map,
sorted_undefined_fun_symbols}): New data members.
* src/abg-dwarf-reader.cc (get_symbol_versionning_sections): Also
return the SHT_GNU_verneed section.
(get_version_needed_for_versym): New static function.
(get_version_definition_for_versym): Factorize this function out
of ..
(get_version_for_symbol): ... this one.  Take a flag that says if
we want the definition version or the needed version of a symbol.
Extend the implementation using the two new function
get_version_needed_for_versym() and
get_version_definition_for_versym() above.  This function now
returns the version either for a defined & exported symbol, or for
an undefined symbol.
(lookup_symbol_from_sysv_hash_tab)
(lookup_symbol_from_gnu_hash_tab, lookup_symbol_from_symtab):
Adjust for the change of signature of get_version_for_symbol().
(read_context::{undefined_fun_syms_, undefined_var_syms_}): New
data members.
(read_context::lookup_elf_symbol_from_index): Adjust for
invocation of the new signature of get_version_for_symbol().
(read_context::{undefined_fun_syms_sptr, undefined_fun_syms,
undefined_var_syms_sptr, undefined_var_syms}): Define new methods.
(read_context::load_symbol_maps): Add support for loading
undefined symbols and their versions.
(read_context::maybe_load_symbol_maps):  Take in account the need
to load undefined symbols as well.
(read_corpus_from_elf): Once the undefined symbols have been read
from the ELF file, stuff them into the resulting ABI corpus that
has been built.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
include/abg-corpus.h
src/abg-corpus.cc
src/abg-dwarf-reader.cc
This page took 0.03435 seconds and 5 git commands to generate.