Don't gc non-alloca non-string pieces.

We were already doing it for strings. This matches the behavior of
bfd and gold.

llvm-svn: 284598
This commit is contained in:
Rafael Espindola 2016-10-19 14:50:26 +00:00
parent ed84103a1a
commit 2adccee13f
2 changed files with 8 additions and 1 deletions

View File

@ -615,8 +615,9 @@ MergeInputSection<ELFT>::splitNonStrings(ArrayRef<uint8_t> Data,
std::vector<SectionPiece> V;
size_t Size = Data.size();
assert((Size % EntSize) == 0);
bool IsAlloca = this->getSectionHdr()->sh_flags & SHF_ALLOC;
for (unsigned I = 0, N = Size; I != N; I += EntSize)
V.emplace_back(I, Data.slice(I, EntSize));
V.emplace_back(I, Data.slice(I, EntSize), !IsAlloca);
return V;
}

View File

@ -5,6 +5,8 @@
# CHECK: Contents of section .debug_str:
# CHECK-NEXT: 0000 41414100 42424200 43434300 AAA.BBB.CCC.
# CHECK: Contents of section .foo:
# CHECK-NEXT: 0000 2a000000
# CHECK: Contents of section .debug_info:
# CHECK-NEXT: 0000 00000000 04000000
@ -19,6 +21,10 @@ _start:
.Linfo_string2:
.asciz "CCC"
.section .foo,"M",@progbits,4
.p2align 2
.long 42
.section .debug_info,"",@progbits
.long .Linfo_string0
.long .Linfo_string1