Skip to content

Commit 17f71de

Browse files
committedDec 11, 2017
ELF: Do not follow relocation edges to output sections during GC.
This fixes an assertion error introduced by r320390. Differential Revision: https://reviews.llvm.org/D41095 llvm-svn: 320431
1 parent 9c8d7f8 commit 17f71de

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed
 

‎lld/ELF/MarkLive.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,13 @@ static void resolveReloc(InputSectionBase &Sec, RelT &Rel,
7171
SS->getFile<ELFT>()->IsNeeded = true;
7272

7373
if (auto *D = dyn_cast<Defined>(&B)) {
74-
if (!D->Section)
74+
auto *RelSec = dyn_cast_or_null<InputSectionBase>(D->Section);
75+
if (!RelSec)
7576
return;
7677
uint64_t Offset = D->Value;
7778
if (D->isSection())
7879
Offset += getAddend<ELFT>(Sec, Rel);
79-
Fn(cast<InputSectionBase>(D->Section), Offset);
80+
Fn(RelSec, Offset);
8081
return;
8182
}
8283

‎lld/test/ELF/gc-sections-linker-defined-symbol.s

+2
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,6 @@
1313
# CHECK-NEXT: Section: .dynamic
1414

1515
.data
16+
.globl g
17+
g:
1618
.quad _end

0 commit comments

Comments
 (0)
Please sign in to comment.