[PATCH] D82010: [llvm-readobj] - Add a validation of the GNU hash table to printGnuHashHistogram().

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 17 06:26:25 PDT 2020


grimar created this revision.
grimar added reviewers: jhenderson, MaskRay.
Herald added subscribers: rupprecht, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.

Similar to D81937 <https://reviews.llvm.org/D81937>, we might crash when printing a histogram for a GNU hash table
with a 'symndx' index that is larger than the number of dynamic symbols.

This patch adopts and reuses the `getGnuHashTableChains()` helper which performs
a validation of the table. As a side effect the warning reported for
the --gnu-hash-table was improved.

Also with this change we start to report a warning when the histogram is requested for
the GNU hash table, but the dynamic symbols table is empty (size == 0).


https://reviews.llvm.org/D82010

Files:
  llvm/test/tools/llvm-readobj/ELF/gnuhash.test
  llvm/test/tools/llvm-readobj/ELF/hash-histogram.test
  llvm/tools/llvm-readobj/ELFDumper.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82010.271350.patch
Type: text/x-patch
Size: 7861 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200617/28666c6d/attachment.bin>


More information about the llvm-commits mailing list