This is an archive of the discontinued LLVM Phabricator instance.

[llvm-readobj] - Refine the error reporting in LLVMStyle<ELFT>::printELFLinkerOptions.
ClosedPublic

Authored by grimar on Jul 3 2020, 7:32 AM.

Details

Summary

It is possible to:

  1. Avoid using the unwrapOrError calls and hence allow to continue dumping even when something is not OK with one of SHT_LLVM_LINKER_OPTIONS sections.
  2. replace reportWarning with reportUniqueWarning calls. In this method it is no-op, because it is not possible to have a duplicated warnings anyways, but since we probably want to switch to reportUniqueWarning globally, this is a good thing to do.

This patch addresses both these points.

Diff Detail

Event Timeline

grimar created this revision.Jul 3 2020, 7:32 AM
Herald added a project: Restricted Project. · View Herald Transcript
  1. replace reportWarning with reportUniqueWarning calls. In this method it is no-op, because it is not possible to have a duplicated warnings anyways, but since we probably want to switch to reportUniqueWarning globally, this is a good thing to do.

My understanding of the inline comments in D69671 is that we will change reportWarning call sites to use reportUniqueWarning and then rename reportUniqueWarning to reportWarning. Is that the case?

MaskRay accepted this revision.Jul 4 2020, 11:39 AM
This revision is now accepted and ready to land.Jul 4 2020, 11:39 AM
jhenderson added inline comments.Jul 6 2020, 12:50 AM
llvm/test/tools/llvm-readobj/ELF/linker-options.test
12

Repeating the "index 5" bit in the warning seems sub-optimal. I think it's only necessary if we don't trust the warning produced by the Object library to include the index?

grimar marked an inline comment as done.Jul 6 2020, 1:56 AM
  1. replace reportWarning with reportUniqueWarning calls. In this method it is no-op, because it is not possible to have a duplicated warnings anyways, but since we probably want to switch to reportUniqueWarning globally, this is a good thing to do.

My understanding of the inline comments in D69671 is that we will change reportWarning call sites to use reportUniqueWarning and then rename reportUniqueWarning to reportWarning. Is that the case?

Yes.

llvm/test/tools/llvm-readobj/ELF/linker-options.test
12

That is why I've introduced it, but now I see that getSectionContents() always includes the index and it is probably unlikely that one day it will get to some another case when it will not do it. I'll update this place.

grimar updated this revision to Diff 275632.Jul 6 2020, 3:10 AM
grimar marked an inline comment as done.
  • Addressed review comments.
This revision was automatically updated to reflect the committed changes.