dwarf-reader: relax restriction about relocation sections in try_reading_first_ksymta...
authorMatthias Maennich <maennich@google.com>
Wed, 13 Nov 2019 15:09:17 +0000 (15:09 +0000)
committerMatthias Maennich <maennich@google.com>
Tue, 7 Jan 2020 14:47:36 +0000 (14:47 +0000)
Commit 43679a610316 ("dwarf-reader: refactor
try_reading_first_ksymtab_entry_using{pre,}_v4_19_format") introduced an
assertion to ensure the absence of ksymtab relocation sections as they
are an unhandled case for try_reading_first_ksymtab_entry. This
assertion turns out to be too strict as relocation sections might be
present (e.g. on x86_64), but not affecting the functionality of this
function (i.e. helping to detect the ksymtab format). Hence, remove the
assertion and document that case.

* src/abg-dwarf-reader.cc (try_reading_first_ksymtab_entry):
remove assertion and update documentation

Fixes: 43679a610316 ("dwarf-reader: refactor try_reading_first_ksymtab_entry_using{pre,}_v4_19_format")
Reviewed-by: Dodji Seketeli <dodji@seketeli.org>
Signed-off-by: Matthias Maennich <maennich@google.com>
src/abg-dwarf-reader.cc

index bb1ffc1..d3efb02 100644 (file)
@@ -7632,10 +7632,15 @@ public:
   /// the section designated by @p section contains position-relative
   /// relocated symbol addresses.
   ///
-  ///@param symbol_offset if different from zero
+  /// @param symbol_offset if different from zero
   /// If symbol_offset is != 0, adjust the position we consider the section
   /// start. That is useful to read the ksymtab with a slight offset.
   ///
+  /// Note, this function does not support relocatable ksymtab entries (as for
+  /// example in kernel modules). Using this function for ksymtabs where
+  /// relocations need to be applied for the entries we are reading here, will
+  /// yield wrong results.
+  ///
   /// @return the symbol resulting from the lookup of the symbol address we
   /// got from reading the first entry of the ksymtab or null if no such entry
   /// could be found.
@@ -7644,12 +7649,6 @@ public:
                                  bool position_relative_relocations,
                                  int  symbol_offset = 0) const
   {
-    // this function does not support relocatable ksymtab entries (as for
-    // example in kernel modules). Hence assert here on not having any
-    // relocation sections around. We can consider this a TODO that we have to
-    // work around in the rest of the code.
-    ABG_ASSERT(!find_any_ksymtab_reloc_section());
-
     Elf_Data*      elf_data = elf_rawdata(section, 0);
     uint8_t*       bytes = reinterpret_cast<uint8_t*>(elf_data->d_buf);
     bool           is_big_endian = elf_architecture_is_big_endian();