diff options
-rw-r--r-- | lld/ELF/InputSection.cpp | 3 | ||||
-rw-r--r-- | lld/test/ELF/debug-gc.s | 6 |
2 files changed, 8 insertions, 1 deletions
diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp index 296c3a67c6e..76795a24ac6 100644 --- a/lld/ELF/InputSection.cpp +++ b/lld/ELF/InputSection.cpp @@ -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; } diff --git a/lld/test/ELF/debug-gc.s b/lld/test/ELF/debug-gc.s index 5254220f5cb..8bcfde16a7b 100644 --- a/lld/test/ELF/debug-gc.s +++ b/lld/test/ELF/debug-gc.s @@ -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 |