[PATCH] D50204: [llvm-objdump] Label calls to the PLT

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 3 10:17:12 PDT 2018


pcc added inline comments.


================
Comment at: tools/llvm-objdump/llvm-objdump.cpp:1244
+          StringRef Str;
+          return !Section.getName(Str) && Str == ".plt";
+        });
----------------
paulsemel wrote:
> Not sure this is the correct way to get the PLT section. Here is how GNU readelf does : first, it searches in the dynamic entries, and then, if there is no dynamic tables, it tries to find by name.
> 
> There is a helper for getting dynamic entries in the libObject : `dynamicEntries()` in include/llvm/Object/ELF.h
> 
> Btw, I think it might be cool to have a helper that gets the PLT section in the libObject. And you might want to use it also in https://reviews.llvm.org/D50203.
Is there a DT tag for the PLT? At least I can't seem to see one in either an x86_64 or aarch64 binary, which makes sense to me because from the loader's perspective the PLT is just another block of code.


================
Comment at: tools/llvm-objdump/llvm-objdump.cpp:1262
+      // AllSymbols works.
+      PltEntryNames.push_back((*Name + "@plt").str());
+
----------------
I think the general way that this is done is with the StringSaver class.


Repository:
  rL LLVM

https://reviews.llvm.org/D50204





More information about the llvm-commits mailing list