corpus: make get_(undefined_)?_(var|fun)_symbols use the new symtab

Make the corresponding members an implementation detail of corpus::priv.
They get computed based on the new symtab whenever they are accessed
first with an atomic instantiation. That simplifies the implementation
and homogenizes the access to functions and variables. Sorting does not
need to be done as the symtab already gives a guarantee for that.

Due to improved alias detection in the new symtab reader, ensure we only
write symbol aliases to ksymtab symbols if having a ksymtab main symbol.

Test data needed to be adjusted as the new symtab reader is stricter in
regards to symbols listed in ksymtab. I.e. init_module is not an
exported symbol in the ksymtab of a kernel module.

	* src/abg-corpus-priv.h (corpus::priv::sorted_var_symbols): make
	  private, mutable and optional.
	  (corpus::sorted_undefined_var_symbols): Likewise.
	  (corpus::sorted_fun_symbols): Likewise.
	  (corpus::sorted_undefined_fun_symbols): Likewise.
	  (corpus::priv::get_sorted_fun_symbols): New method declaration.
	  (corpus::priv::get_sorted_undefined_fun_symbols): Likewise.
	  (corpus::priv::get_sorted_var_symbols): Likewise.
	  (corpus::priv::get_sorted_undefined_var_symbols): Likewise.
	* src/abg-corpus.cc
	  (corpus::elf_symbol_comp_functor): Delete struct.
	  (corpus::priv::get_sorted_fun_symbols): New method implementation.
	  (corpus::priv::get_sorted_undefined_fun_symbols): Likewise.
	  (corpus::priv::get_sorted_var_symbols): Likewise.
	  (corpus::priv::get_sorted_undefined_var_symbols): Likewise.
	  (corpus::get_sorted_fun_symbols): Proxy call to corpus::priv.
	  (corpus::get_sorted_undefined_fun_symbols): Likewise.
	  (corpus::get_sorted_var_symbols): Likewise.
	  (corpus::get_sorted_undefined_var_symbols): Likewise.
	* src/abg-writer.cc (write_elf_symbol_aliases): When emitting
	  aliases for a kernel symbol, ensure to only emit exported aliases.
	* tests/data/test-read-dwarf/PR25007-sdhci.ko.abi: update test
	  data.

Signed-off-by: Matthias Maennich <maennich@google.com>
Change-Id: I6734a55a2f1da606ab6c542919ef58fcfcd1f50a
4 files changed