From cde251370a8db399e530bd02b48b46ab1c11e174 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Thu, 13 Aug 2015 14:45:44 +0000 Subject: [PATCH] Include non-alloca sections in the link. llvm-svn: 244895 --- lld/ELF/InputFiles.cpp | 14 ++++++++++---- lld/test/elf2/string-table.s | 8 ++++++-- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp index 205ba87..e319fcd9 100644 --- a/lld/ELF/InputFiles.cpp +++ b/lld/ELF/InputFiles.cpp @@ -41,13 +41,19 @@ template void elf2::ObjectFile::initializeChunks() { 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(this->getObj(), &Sec); Chunks.push_back(C); + break; } } } diff --git a/lld/test/elf2/string-table.s b/lld/test/elf2/string-table.s index 860ccf16..31a4c65 100644 --- a/lld/test/elf2/string-table.s +++ b/lld/test/elf2/string-table.s @@ -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" -- 2.7.4