[PATCH] D13286: [ELF2] Add --[no-]whole-archive command line switches

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 1 09:58:28 PDT 2015


ruiu added inline comments.

================
Comment at: ELF/InputFiles.cpp:219
@@ +218,3 @@
+std::vector<MemoryBufferRef> ArchiveFile::getMembers() {
+  // We have to hold it in case of a thin archive.
+  File = openArchive(MB);
----------------
Remove this comment.

================
Comment at: ELF/SymbolTable.cpp:33-36
@@ -34,1 +32,6 @@
+    File.release();
+    // ArchiveFile should be kept in both cases:
+    // * WholeArchive: it might be a thin archive which holds actual
+    //   memory buffers of its members.
+    // * !WholeArchive: it holds lazy symbols.
     ArchiveFiles.emplace_back(AF);
----------------
Is that true? MemoryBuffers are not freed until the end of Driver, so it should be safe if thin archives have references to MemoryBuffers.

================
Comment at: ELF/SymbolTable.cpp:39-40
@@ +38,4 @@
+    if (Config->WholeArchive) {
+      for (MemoryBufferRef &MBRef : AF->getMembers())
+        addFile(createELFFile<ObjectFile>(MBRef));
+    } else {
----------------
Please return here.


http://reviews.llvm.org/D13286





More information about the llvm-commits mailing list