Fix another --gc-sections crash.

The missing case was when a merge section was only referenced from
non-alloca sections.

llvm-svn: 282847
This commit is contained in:
Rafael Espindola
2016-09-30 06:48:09 +00:00
parent b3e7d68d5c
commit 2629602f28
2 changed files with 9 additions and 0 deletions

View File

@@ -620,6 +620,9 @@ typename ELFT::uint MergeInputSection<ELFT>::getOffset(uintX_t Offset) const {
if (It != OffsetMap.end())
return It->second;
if (!this->Live)
return 0;
// If Offset is not at beginning of a section piece, it is not in the map.
// In that case we need to search from the original section piece vector.
const SectionPiece &Piece = *this->getSectionPiece(Offset);

View File

@@ -17,5 +17,11 @@ _start:
.Lbar:
.long 2
.section .merge2,"aM",@progbits,4
.p2align 2
.Lzed:
.long 1
.section bar
.quad .Lbar
.quad .Lzed