[PATCH] D39272: llvm-readobj: Add support for reading relocations in the Android packed format.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 24 18:50:32 PDT 2017


ruiu added inline comments.


================
Comment at: llvm/lib/Object/ELF.cpp:478
 
+template <class ELFT>
+Expected<std::vector<typename ELFT::Rela>>
----------------
It is probably worth to mention briefly as a function comment that this function reads relocations represented as ULEB128 values, which is a compact relocation format invented for Android.


================
Comment at: llvm/lib/Object/ELF.cpp:492
+  const char *ErrStr = nullptr;
+  auto ReadSLEB = [&]() -> int64_t {
+    if (ErrStr)
----------------
nit: I believe you can omit ()


================
Comment at: llvm/lib/Object/ELF.cpp:527
+    if (GroupedByAddend && GroupHasAddend)
+      Addend += ReadSLEB();
+
----------------
Can this RHS expression return a negative value? If not, Addend is a monotonically increasing, which is odd.


================
Comment at: llvm/lib/Object/ELF.cpp:550
+    NumRelocs -= NumRelocsInGroup;
+
+    if (ErrStr)
----------------
I'd add a check to make sure that NumRelocs is not negative.


https://reviews.llvm.org/D39272





More information about the llvm-commits mailing list