[PATCH] D54782: [ELF] Take IPLT header size into account in -static -z retpolineplt mode

Ed Maste via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 21 06:24:22 PST 2018


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

Confirmed this fixes my bug.



================
Comment at: ELF/SyntheticSections.cpp:2283
                        Config->EMachine == EM_PPC64 ? ".glink" : ".plt"),
-      HeaderSize(IsIplt ? 0 : Target->PltHeaderSize), IsIplt(IsIplt) {
+      HeaderSize(IsIplt && !Config->ZRetpolineplt ? 0 : Target->PltHeaderSize),
+      IsIplt(IsIplt) {
----------------
At first this seemed slightly confusing to me vs. the test at line 2294; maybe the test could be the same?
`!IsIplt || Config->ZRetpolineplt ? Target->PltHeaderSize : 0`


================
Comment at: ELF/SyntheticSections.cpp:2292
 void PltSection::writeTo(uint8_t *Buf) {
   // At beginning of PLT but not the IPLT, we have code to call the dynamic
   // linker to resolve dynsyms at runtime. Write such code.
----------------
Perhaps update the comment too? e.g. //beginning of PLT but not non-retpoline IPLT//, although we're basically just repeating the code. Not sure of a succinct way to express this.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D54782





More information about the llvm-commits mailing list