[PATCH] D14450: [ELF2] Add mandatory .dynamic section entries on MIPS.

Igor Kudrin via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 6 11:28:09 PST 2015


ikudrin added inline comments.

================
Comment at: ELF/OutputSections.cpp:491
@@ -480,3 +490,3 @@
     ++NumEntries; // DT_PLTRELSZ
-    ++NumEntries; // DT_PLTGOT
+    ++NumEntries; // DT_PLTGOT or DT_MIPS_PLTGOT
     ++NumEntries; // DT_PLTREL
----------------
atanasyan wrote:
> Do you read MIPS ABI? DT_MIPS_PLTGOT is used in the non-PIC MIPS code only. PIC MIPS code uses DT_PLTGOT entry but this entry points to the .got section.
The logic of this line: if we have .plt.got section, then store its address to DT_MIPS_PLTGOT entry. Is something wrong here?
Please note, the DT_PLTGOT entry for MIPS target is mentioned a bit later in this function.

================
Comment at: ELF/OutputSections.cpp:659
@@ +658,3 @@
+    WriteVal(DT_MIPS_SYMTABNO, Out<ELFT>::DynSymTab->getNumSymbols());
+    if (const SymbolBody *B = Out<ELFT>::Got->getFirstEntry()) {
+      WriteVal(DT_MIPS_LOCAL_GOTNO, B->GotIndex);
----------------
atanasyan wrote:
> What is the case covered by this `if` statement?
We can have global entries in the GOT or it may consist of reserved and local entries only. In the later case, we'll have to change the expression "Target->getGotHeaderEntriesNum()" to something more reasonable when local GOT entries are added.

================
Comment at: ELF/OutputSections.h:121
@@ -120,2 +120,3 @@
   uintX_t getEntryAddr(const SymbolBody &B) const;
+  const SymbolBody *getFirstEntry() const;
 
----------------
atanasyan wrote:
> What is the meaning of the "First" here: Lazy resolver, first local entry of first global entry?
For MIPS, it's the first global entry, because we don't have SymbolBody for anything else.
For all other targets it's just the first entry of the GOT, although nobody is interested in it.


http://reviews.llvm.org/D14450





More information about the llvm-commits mailing list