[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] dwarf-reader: relax restriction about relocation sections in try_reading_first_ksymtab_entry



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")
Signed-off-by: Matthias Maennich <maennich@google.com>
---
 src/abg-dwarf-reader.cc | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc
index 4065b82512ba..85b8e2461721 100644
--- a/src/abg-dwarf-reader.cc
+++ b/src/abg-dwarf-reader.cc
@@ -7630,10 +7630,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.
@@ -7642,12 +7647,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();
-- 
2.24.0.rc1.363.gb1bccd3e3d-goog