abg-dwarf-reader: detect kernel modules without exports as such
authorMatthias Maennich <maennich@google.com>
Wed, 24 Jul 2019 21:32:55 +0000 (22:32 +0100)
committerDodji Seketeli <dodji@redhat.com>
Thu, 25 Jul 2019 08:36:44 +0000 (10:36 +0200)
commit413381ee7f99c0a2bef1c6d76c1c06fb17160a1b
treea3256796eee9cba06cec77068154209729c28274
parentd7ae619ff3360480348f7f1ab58fdb3be85aa079
abg-dwarf-reader: detect kernel modules without exports as such

Kernel modules without exported symbols (no use of EXPORT_SYMBOL*()),
will not have a __ksymtab_strings section. Libabigail will therefore
assume they are usual ELF binaries. That leads to wrong results as
now all ELF symbols are considered part of the ABI. That is obviously
wrong. Instead consider binaries having a .modinfo section to be kernel
binaries. We keep the __ksymtab_strings condition as vmlinux has no
.modinfo section but a __ksymtab_strings if symbols are exported.

One case is still open (and requires maybe some documentation): if a
kernel does not export symbols (no module support), none of the
conditions apply. But, who would be interested in the ABI of a kernel
that does not expose any?

* src/abg-dwarf-reader.cc(is_linux_kernel_binary): consider
  binaries only having a .modinfo section to be kernel binaries

Co-developed-by: Alessio Balsini <balsini@android.com>
Signed-off-by: Alessio Balsini <balsini@android.com>
Signed-off-by: Matthias Maennich <maennich@google.com>
src/abg-dwarf-reader.cc