[PATCH] D55852: [elfabi] Add support for reading DT_NEEDED from binaries

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 28 14:02:18 PST 2018


ruiu added inline comments.


================
Comment at: llvm/tools/llvm-elfabi/ELFObjHandler.cpp:45-51
     size_t StrEnd = Str.find('\0', Offset);
     if (StrEnd == StringLiteral::npos) {
       return Str.substr(Offset);
     }
 
     size_t StrLen = StrEnd - Offset;
     return Str.substr(Offset, StrLen);
----------------
Indentation should be 2 spaces.


================
Comment at: llvm/tools/llvm-elfabi/ELFObjHandler.cpp:148
+  for (uint64_t NeededStrOffset : DynEnt.NeededLibNames) {
+    DestStub->NeededLibs.push_back(terminatedSubstr(DynStr, NeededStrOffset));
+  }
----------------
I think all strings in a string table should be terminated with '\0' in any ELF file. If the last string "overruns" the string table, it is an error, and the last string should not automatically be terminated at the end of the string table.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D55852





More information about the llvm-commits mailing list