[all-commits] [llvm/llvm-project] 2a4df6: [llvm-readobj] - Refactor how the code dumps reloc...

Georgii Rymar via All-commits all-commits at lists.llvm.org
Mon Jul 20 02:05:48 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 2a4df6a3250870910176eae8f0c2b199c6a8cdde
      https://github.com/llvm/llvm-project/commit/2a4df6a3250870910176eae8f0c2b199c6a8cdde
  Author: Georgii Rymar <grimar at accesssoftek.com>
  Date:   2020-07-20 (Mon, 20 Jul 2020)

  Changed paths:
    M llvm/include/llvm/Object/ELF.h
    M llvm/lib/Object/ELF.cpp
    M llvm/tools/llvm-readobj/ELFDumper.cpp

  Log Message:
  -----------
  [llvm-readobj] - Refactor how the code dumps relocations.

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.

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




More information about the All-commits mailing list