[PATCH] D23661: [ELF] Fix sorting in combrelocs mode and add DT_REL(A)COUNT to .dynamic

Eugene Leviant via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 29 14:06:59 PDT 2016


evgeny777 added inline comments.

================
Comment at: ELF/OutputSections.cpp:672-674
@@ -664,1 +671,5 @@
+
+    size_t NumRelativeRels = Out<ELFT>::RelaDyn->getRelativeRelocCount();
+    if (Config->ZCombreloc && NumRelativeRels)
+      Add({IsRela ? DT_RELACOUNT : DT_RELCOUNT, NumRelativeRels});
   }
----------------
ruiu wrote:
> I'm not sure if it is the right thing to not emit DT_REL[A]COUNT if there are no relative relocations. If the number of relative relocations is zero, shouldn't we write zero?
This doc:
https://docs.oracle.com/cd/E19957-01/806-0641/6j9vuqujs/index.html

Says that DT_RELACOUNT is an optional field. Our dynamic linker assumes that number of relative relocs is zero, unless there is a DT_REL(A)COUNT tag. That said, I don't see any reason for writing it always.


https://reviews.llvm.org/D23661





More information about the llvm-commits mailing list