[PATCH] D55629: [elfabi] Add support for reading DT_SONAME from binaries

Jake Ehrlich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 4 14:28:27 PST 2019


jakehehrlich accepted this revision.
jakehehrlich added a comment.
This revision is now accepted and ready to land.

Super informative error messages!

two small things to fix before you land.



================
Comment at: llvm/tools/llvm-elfabi/ELFObjHandler.cpp:130
+static Expected<uint64_t> addrAsOffset(typename ELFT::PhdrRange PHdrs,
+                                       uint64_t Addr, uint64_t Range = 1) {
+  for (auto &Entry : PHdrs) {
----------------
This hole Range thing is super confusing to me. Just have Addr and Size and just demand the user supplies Size.


================
Comment at: llvm/tools/llvm-elfabi/ELFObjHandler.cpp:135
+
+    if (Addr >= Entry.p_vaddr &&
+        Addr < Entry.p_vaddr + Entry.p_filesz) {
----------------
You can just do `Addr >= Entry.p_vaddr && Addr + Size < Entry.p_vaddr + Entry.file_sz`


Repository:
  rL LLVM

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

https://reviews.llvm.org/D55629





More information about the llvm-commits mailing list