[PATCH] D83871: [llvm-readobj/readelf] - Refactor how the code dumps relocations.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 15 07:00:19 PDT 2020


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

There is a strange "feature" of the code: it handles all relocations as `Elf_Rela`.
For handling `Elf_Rel` it converts them to `Elf_Rela` and passes `bool IsRela` to
specify the real type everywhere.

A related issue is that the
`decode_relrs` helper in lib/Object has to return `Expected<std::vector<Elf_Rela>>`
because of that, though it could return a vector of `Elf_Rel`.

I think we should just start using templates for relocation types, it makes the code
cleaner and shorter. This patch does it.


https://reviews.llvm.org/D83871

Files:
  llvm/include/llvm/Object/ELF.h
  llvm/lib/Object/ELF.cpp
  llvm/tools/llvm-readobj/ELFDumper.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83871.278169.patch
Type: text/x-patch
Size: 17820 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200715/05c9fcdf/attachment.bin>


More information about the llvm-commits mailing list