[PATCH] D64470: [Object/ELF] - Improve error reporting for notes.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 10 04:45:59 PDT 2019


grimar marked an inline comment as done.
grimar added inline comments.


================
Comment at: include/llvm/Object/ELF.h:205
+    if (Phdr.p_type != ELF::PT_NOTE)
+      llvm_unreachable("Phdr is not of type PT_NOTE");
+
----------------
jhenderson wrote:
> I'm not sure making this llvm_unreachable is correct: if you are using libObject as a library, you could pass in an invalid Phdr, which should report an error, not an assertion.
Note that method name is `notes_begin`. I.e it expects to accept note `Phdr` and all
code we have do this check now.

I think that It is obviously a error in the code to pass `Phdr` not of type `PT_NOTE` here.
Showing such error to user is unuseful, code just should never do that first of all.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64470/new/

https://reviews.llvm.org/D64470





More information about the llvm-commits mailing list