This is an archive of the discontinued LLVM Phabricator instance.

[llvm-readelf/readobj] - Detemplate printRelRelaReloc() methods.
AbandonedPublic

Authored by grimar on Jul 22 2020, 6:52 AM.

Details

Summary

Methods became templated in D83871.

D83935 tries to move out the common code and I had to introduce
2 more virtual methods: printRelReloc and printRelReloc to call
the templated printRelRelaReloc from the base class,
where the common code lives.

This patch shows that we can call printRelRelaReloc directly from the
base class after making it virtual and detemplating it.

The benefit is that the code becomes shorter. But instead of having just
Elf_Rel/Elf_Rela argument, we will have two: const Elf_Rel &R, Optional<int64_t> Addend

Should we do it?

Diff Detail

Event Timeline

grimar created this revision.Jul 22 2020, 6:52 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 22 2020, 6:52 AM
Herald added a subscriber: rupprecht. · View Herald Transcript

I'm no more a fan of using Elf_Rel for Elf_Rela relocations than I was of using Elf_Rela for Elf_Rel, even with the extra Addend argment. I think if we are to go down this road, I'd split it up into its component parts in the first instance, but that might become too many arguments.

llvm/tools/llvm-readobj/ELFDumper.cpp
6448

I think /*Addend=*/None is the preferred style. Same below.

grimar abandoned this revision.Jul 24 2020, 1:30 AM

OK. I do not have any strong feelings about this. Abandoning.