[PATCH] D25627: [ELF] Convert linker generated sections to input sections

Eugene Leviant via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 28 04:35:26 PDT 2016


evgeny777 added inline comments.


================
Comment at: ELF/Writer.cpp:780
+  for (SyntheticInputSection<ELFT> *S : In<ELFT>::Sections)
+    if (S && S->needed())
+      addInputSec(S);
----------------
ruiu wrote:
> Remove null check. Sections shouldn't contain a nullptr.
Actually they can. In original version if build-id section is not emitted then Out<ELFT>::BuildId is nullptr. isDiscarded() does check for nullptr as well


================
Comment at: ELF/Writer.cpp:869
+      S->finalize();
+      S->OutSec->assignOffsets();
+    }
----------------
ruiu wrote:
> Why do you have to call S->Outsec->assignOffsets?
In order for OutSec to have non-zero size. Normally assignOffsets is called earlier in createSections().


================
Comment at: ELF/Writer.cpp:1495
 template <class ELFT> void Writer<ELFT>::writeBuildId() {
-  if (!Out<ELFT>::BuildId)
+  if (!In<ELFT>::BuildId || !In<ELFT>::BuildId->OutSec)
     return;
----------------
ruiu wrote:
> You want to use needed() for consistency.
I've removed needed() in upcoming diff, because it isn't required for BuildIdSection.


https://reviews.llvm.org/D25627





More information about the llvm-commits mailing list