[PATCH] D92081: [libObject,llvm-readelf] - Stop describing a section/segment in `notes_begin()`.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 25 01:27:47 PST 2020

grimar added a comment.

In D92081#2415682 <https://reviews.llvm.org/D92081#2415682>, @jhenderson wrote:

> Just to rephrase your initial description to make sure I understand, the reason we can't rely on the `notes_begin` method to report the context itself is because not all errors that `notes_begin` could ultimately report have the information needed to provide this context, right? And because of this, we need the context to be added at a higher level, right?

Yes. `notes_begin` returns `Elf_Note_Iterator` which might report errors when used, but it doesn't have a context.

I.e. this construction might report errors from both iterator and `notes_begin()` call by itself:

  Error Err = Error::success();
  for (const typename ELFT::Note Note : Obj.notes(P, Err))

Comment at: llvm/tools/llvm-readobj/ELFDumper.cpp:5591
+      reportError(
+          createError("unable to read notes from the PT_NOTE segment: " +
+                      toString(std::move(Err))),
jhenderson wrote:
> There could be more than one PT_NOTE segment, so perhaps this should also say something about the segment's index or other identifying property, so that it can be clearly identified. What do you think?
Yes. This is what D92021 does.



More information about the llvm-commits mailing list