[PATCH] D13544: ELF2: Make SymbolTable a template class.

Rafael Ávila de Espíndola via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 9 13:00:42 PDT 2015


rafael added inline comments.

================
Comment at: ELF/Driver.cpp:165
@@ +164,3 @@
+  default:
+    llvm_unreachable("Invalid kind");
+  }
----------------
We can get here with

ld.lld2 -u foo has_a_foo.a

no? This is not a regression, but please make it an explicit error. Something like "-m or at least a .o file required".

================
Comment at: ELF/Driver.cpp:241
@@ +240,3 @@
+
+  for (std::unique_ptr<InputFile> &File : Files) {
+    auto *F = dyn_cast<ELFFileBase>(File.get());
----------------
Why do you need these extra loops? You can keep checking for incompatible files as they are created, no?

================
Comment at: ELF/OutputSections.cpp:327
@@ -326,6 +326,3 @@
 
-  const std::vector<std::unique_ptr<SharedFileBase>> &SharedFiles =
-      SymTab.getSharedFiles();
-  for (const std::unique_ptr<SharedFileBase> &File : SharedFiles)
-    Out<ELFT>::DynStrTab->add(File->getSoName());
-  NumEntries += SharedFiles.size();
+  for (const std::unique_ptr<SharedFile<ELFT>> &F : SymTab.getSharedFiles()) {
+    Out<ELFT>::DynStrTab->add(F->getSoName());
----------------
Other than dropping the "Base" this is independent. Please commit first and rebase.

================
Comment at: ELF/OutputSections.cpp:404
@@ -404,5 +403,3 @@
 
-  const std::vector<std::unique_ptr<SharedFileBase>> &SharedFiles =
-      SymTab.getSharedFiles();
-  for (const std::unique_ptr<SharedFileBase> &File : SharedFiles)
+  for (const std::unique_ptr<SharedFile<ELFT>> &File : SymTab.getSharedFiles())
     WriteVal(DT_NEEDED, Out<ELFT>::DynStrTab->getFileOff(File->getSoName()));
----------------
This too.


http://reviews.llvm.org/D13544





More information about the llvm-commits mailing list