[PATCH] D18814: Implement --start-lib and --end-lib.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 6 16:29:28 PDT 2016


ruiu added inline comments.

================
Comment at: ELF/InputFiles.cpp:285
@@ -284,1 +284,3 @@
 template <class ELFT> void elf::ObjectFile<ELFT>::initializeSymbols() {
+  for (const Elf_Shdr &Sec : this->ELFObj.sections())
+    if (Sec.sh_type == SHT_DYNSYM)
----------------
rafael wrote:
> Why do you need this?
Removed.

================
Comment at: ELF/InputFiles.h:44
@@ +43,3 @@
+    ArchiveKind,
+    BitcodeKind
+  };
----------------
rafael wrote:
> So, --start-lib foo.bc --end-lib should work. This suggests that it should be a flag in the class saying that it is lazy, not a new type.
Reusing the existing File classes for lazy files was not easy as I expected. For example, the existing parse function takes a list of COMDAT group names. When creating lazy files, we don't want to read or write the list because parsing a lazy file should have any semantic meaning. Therefore, it seems to be easier to keep LazyObjectFile as a separate class than making a flag.

================
Comment at: ELF/InputFiles.h:165
@@ -156,1 +164,3 @@
 
+template <class ELFT> class LazyObjectFile : public ELFFileBase<ELFT> {
+  typedef ELFFileBase<ELFT> Base;
----------------
rafael wrote:
> It should be possible to use bitcode files in --start-lib/--end-lib, so this should inherit from InputFile, like ArchiveFile does
> 
> It can then have two subclasses or just know that it can be wrapping a .o or a .bc.
Done.


http://reviews.llvm.org/D18814





More information about the llvm-commits mailing list