[PATCH] D88561: [llvm-readobj] - Fix possible crashes related to dumping gnu hash symbols.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 8 01:43:32 PDT 2020


grimar added inline comments.


================
Comment at: llvm/test/tools/llvm-readobj/ELF/gnuhash.test:128
 # SYMNDX-NEXT:   Buckets: [2]
-# SYMNDX-NEXT: warning: '[[FILE]]': unable to dump 'Values' for the SHT_GNU_HASH section: the first hashed symbol index (2) is larger than the number of dynamic symbols (2)
+# SYMNDX-NEXT: warning: '[[FILE]]': unable to dump 'Values' for the SHT_GNU_HASH section: the first hashed symbol index (2) is greater than or equal to the number of dynamic symbols (2)
 # SYMNDX-NEXT: }
----------------
jhenderson wrote:
> grimar wrote:
> > jhenderson wrote:
> > > This test looks like it might need updating?
> > This message comes from a different place,
> > for LLVM style we show it when fail to dump `Values`:
> > 
> > ```
> > void ELFDumper<ELFT>::printGnuHashTable() {
> > .....
> > 
> >   Expected<ArrayRef<Elf_Word>> Chains =
> >       getGnuHashTableChains<ELFT>(DynSymRegion, GnuHashTable);
> >   if (!Chains) {
> >     reportUniqueWarning(
> >         createError("unable to dump 'Values' for the SHT_GNU_HASH "
> >                     "section: " +
> >                     toString(Chains.takeError())));
> >     return;
> >   }
> > 
> >   W.printHexList("Values", *Chains);
> > ```
> > 
> > I.e. it is unrelated to this patch, I think I just copypasted this error previously.
> > And for this particular place it seems that mentioning `'Values'` in the message is reasonable.
> Okay (but I don't think `'Values'` makes sense - values of what?)
An example of normal output is:

```
GnuHashTable {
  Num Buckets: 3
  First Hashed Symbol Index: 1
  Num Mask Words: 2
  Shift Count: 2
  Bloom Filter: [0x3, 0x4]
  Buckets: [5, 6, 7]
  Values: [0x8, 0x9, 0xA, 0xB]
}
```

I.e. `Values` refers to the field that was expected to be dumped, but was not because of an error.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88561/new/

https://reviews.llvm.org/D88561



More information about the llvm-commits mailing list