[lld] r244895 - Include non-alloca sections in the link.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 13 07:45:45 PDT 2015


Author: rafael
Date: Thu Aug 13 09:45:44 2015
New Revision: 244895

URL: http://llvm.org/viewvc/llvm-project?rev=244895&view=rev
Log:
Include non-alloca sections in the link.

Modified:
    lld/trunk/ELF/InputFiles.cpp
    lld/trunk/test/elf2/string-table.s

Modified: lld/trunk/ELF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=244895&r1=244894&r2=244895&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.cpp (original)
+++ lld/trunk/ELF/InputFiles.cpp Thu Aug 13 09:45:44 2015
@@ -41,13 +41,19 @@ template <class ELFT> void elf2::ObjectF
   uint64_t Size = ELFObj->getNumSections();
   Chunks.reserve(Size);
   for (const Elf_Shdr &Sec : ELFObj->sections()) {
-    if (Sec.sh_type == SHT_SYMTAB) {
+    switch (Sec.sh_type) {
+    case SHT_SYMTAB:
       Symtab = &Sec;
-      continue;
-    }
-    if (Sec.sh_flags & SHF_ALLOC) {
+      break;
+    case SHT_STRTAB:
+    case SHT_NULL:
+    case SHT_RELA:
+    case SHT_REL:
+      break;
+    default:
       auto *C = new (Alloc) SectionChunk<ELFT>(this->getObj(), &Sec);
       Chunks.push_back(C);
+      break;
     }
   }
 }

Modified: lld/trunk/test/elf2/string-table.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/string-table.s?rev=244895&r1=244894&r2=244895&view=diff
==============================================================================
--- lld/trunk/test/elf2/string-table.s (original)
+++ lld/trunk/test/elf2/string-table.s Thu Aug 13 09:45:44 2015
@@ -6,8 +6,12 @@
 .global _start
 _start:
 
-.section bar, "a"
-.section foobar, "a"
+.section bar
+.section foobar
+
+// Both sections are in the output:
+// CHECK: Name: bar
+// CHECK: Name: foobar
 
 // Test that the sting "bar" is merged into "foobar"
 




More information about the llvm-commits mailing list