[all-commits] [llvm/llvm-project] 245052: [llvm-readelf/obj] - Improve the error reporting i...

Georgii Rymar via All-commits all-commits at lists.llvm.org
Tue Nov 24 00:49:40 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 245052ac3080681915c4da59e871d43ea583debb
      https://github.com/llvm/llvm-project/commit/245052ac3080681915c4da59e871d43ea583debb
  Author: Georgii Rymar <grimar at accesssoftek.com>
  Date:   2020-11-24 (Tue, 24 Nov 2020)

  Changed paths:
    M llvm/test/tools/llvm-readobj/ELF/stack-sizes.test
    M llvm/tools/llvm-readobj/ELFDumper.cpp

  Log Message:
  -----------
  [llvm-readelf/obj] - Improve the error reporting in printStackSize().

This stops using `RelocationRef` API in the `printStackSize` method
and starts using the "regular" API that is used in almost all other places
in ELFDumper.cpp.

This is not only makes the code to be more consistent, but helps to diagnose
issues better, because the `ELFObjectFile` API, which is used
currently to implement stack sized dumping sometimes has a behavior
that just doesn't work well for broken inputs.

E.g see how it gets the `symbol_end` iterator. It will just not work
well for a case when the `sh_size` is broken.

```
template <class ELFT>
basic_symbol_iterator ELFObjectFile<ELFT>::symbol_end() const {
...
  DataRefImpl Sym = toDRI(SymTab, SymTab->sh_size / sizeof(Elf_Sym));
  return basic_symbol_iterator(SymbolRef(Sym, this));
}
```

Differential revision: https://reviews.llvm.org/D91624




More information about the All-commits mailing list