[PATCH] D89379: [llvm-readobj/libObject] - Allow dumping objects that has a broken SHT_SYMTAB_SHNDX section.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 20 00:54:26 PDT 2020


grimar added inline comments.


================
Comment at: llvm/include/llvm/Object/ELFObjectFile.h:699
+  if (DotSymtabShndxSec) {
+    // TODO: Test this error.
+    Expected<ArrayRef<Elf_Word>> ShndxTableOrErr =
----------------
MaskRay wrote:
> Is it because yaml2obj cannot emit a malformed SHT_SYMTAB_SHNDX?
No, it is because I think that testing of this place is a bit unrelated to what this patch does.
The idea of the patch is to allow to create an instance of `ELFObjectFile` when the
`SHT_SYMTAB_SHNDX` can't be read. I had to update this place because of API change,
but hopefully it doesn't mean I need to add a test for each place that can now report an error right now
(given that there are few others "Test this error" TODOs in this file).


Note, that this method (`getSymbolSection`) is very specific: it is only invoked by `llvm-readobj`  by following 3 tests:

```
  LLVM :: tools/llvm-readobj/ELF/AArch64/dwarf-cfi.s
  LLVM :: tools/llvm-readobj/ELF/ARM/dwarf-cfi.s
  LLVM :: tools/llvm-readobj/ELF/stack-sizes.test
```

First two are using it because lib/DebugInfo/DWARF (DWARFObjInMemory) calls it.
Stack sizes implementation also uses `ELFObjectFile<ELFT>::getSymbolSection(DataRefImpl Symb)` API,
though it should probably use `ELFFile<ELFT>` instead (see D87362).




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

https://reviews.llvm.org/D89379



More information about the llvm-commits mailing list