[PATCH] D30494: [ELF] - Do not list sections explicitly for finalizeSynthetic()

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 1 10:58:33 PST 2017


ruiu added inline comments.


================
Comment at: ELF/Writer.cpp:1023-1028
+template <class ELFT> static void finalizeSynthetic(SyntheticSection *SS) {
+  if (!SS || !SS->OutSec || SS->empty())
+    return;
+  SS->finalizeContents();
+  SS->OutSec->template assignOffsets<ELFT>();
+}
----------------
This function probably should go away. You shouldn't call assignOffsets every time you finalize one synthetic section.


================
Comment at: ELF/Writer.cpp:1030-1033
+// Dynamic section must be the last one in this list and dynamic
+// symbol table section (DynSymTab) must be the first one. Dynamic
+// string table should go after others because some sections may
+// add strings there during finalizing.
----------------
This comment doesn't seem to make much sense. You want to mention that dynamic symbols depends on other section contents so they need to be finalized later.


================
Comment at: ELF/Writer.cpp:1035-1038
+  auto IsSpecial = [](SyntheticSection *SS) {
+    return SS == In<ELFT>::DynSymTab || SS == In<ELFT>::Dynamic ||
+           SS == In<ELFT>::DynStrTab;
+  };
----------------
Remove this lambda and inline.


================
Comment at: ELF/Writer.cpp:1176
 
-  // Dynamic section must be the last one in this list and dynamic
-  // symbol table section (DynSymTab) must be the first one.
-  finalizeSynthetic<ELFT>(
-      {In<ELFT>::DynSymTab, In<ELFT>::GnuHashTab, In<ELFT>::HashTab,
-       In<ELFT>::SymTab,    In<ELFT>::ShStrTab,   In<ELFT>::StrTab,
-       In<ELFT>::VerDef,    In<ELFT>::DynStrTab,  In<ELFT>::GdbIndex,
-       In<ELFT>::Got,       In<ELFT>::MipsGot,    In<ELFT>::IgotPlt,
-       In<ELFT>::GotPlt,    In<ELFT>::RelaDyn,    In<ELFT>::RelaIplt,
-       In<ELFT>::RelaPlt,   In<ELFT>::Plt,        In<ELFT>::Iplt,
-       In<ELFT>::Plt,       In<ELFT>::EhFrameHdr, In<ELFT>::VerSym,
-       In<ELFT>::VerNeed,   In<ELFT>::Dynamic});
+  finalizeAllSynthetics<ELFT>();
 }
----------------
finalizeSyntheticSections.


https://reviews.llvm.org/D30494





More information about the llvm-commits mailing list