[PATCH] D91426: [PowerPC] Fix issue where binary uses a .got but is missing a .TOC.

Stefan Pintilie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 23 04:36:49 PST 2020


stefanp added inline comments.


================
Comment at: lld/ELF/SyntheticSections.cpp:710
+    return;
+
+  // Add the size of the header.
----------------
MaskRay wrote:
> stefanp wrote:
> > MaskRay wrote:
> > > Can you use an approach similar to GotPltSection::hasGotPltOffset?
> > I'm sorry but I'm not sure what you are looking for.
> > I assume you mean `GotPltSection::hasGotPltOffRel`.
> > 
> > Are you looking to replace 
> > ```
> > if (config->emachine != EM_PPC64 || ElfSym::globalOffsetTable)
> >     return;
> > ```
> > with something like:
> > ```
> > if (hasGotHeader || ElfSym::globalOffsetTable)
> >     return;
> > ```
> > Where I can then set hasGotHeader from the GotSection constructor and/or PPC specific code?
> > 
> > Or:
> > Should I set `numEntries += target->gotHeaderEntriesNum;` from PPC specific code?
> We should drop `setupPPCDelayedInit` and compute the size of GotSection with an approach similar to `GotPltSection::hasGotPltOffset`
I cannot find `GotPltSection::hasGotPltOffset` it is not in the code.

There are a couple of ways that I could remove
```
numEntries += target->gotHeaderEntriesNum;
```
from this function including adding it to `Symbol::getGotOffset()` in the same way that `Symbol::getGotPltOffset()` does. However, I still have to add the `.TOC.` symbol and so I cannot remove `setupPPCDelayedInit` completely.

I'm sorry but I'm still confused about this comment...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D91426



More information about the llvm-commits mailing list