diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2017-12-11 22:47:43 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2017-12-11 22:47:43 +0000 |
commit | 7ce00780d2f2469b8afba235667e16205dea7946 (patch) | |
tree | bb08b481eb89d8b4a8a9727e39f4aaec0cf9edc4 /lld/ELF/MarkLive.cpp | |
parent | fedf679f6dce00634211943c802db0171c981b30 (diff) |
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
Diffstat (limited to 'lld/ELF/MarkLive.cpp')
-rw-r--r-- | lld/ELF/MarkLive.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lld/ELF/MarkLive.cpp b/lld/ELF/MarkLive.cpp index fbf57a9ee2d..36f994f2049 100644 --- a/lld/ELF/MarkLive.cpp +++ b/lld/ELF/MarkLive.cpp @@ -71,12 +71,13 @@ static void resolveReloc(InputSectionBase &Sec, RelT &Rel, SS->getFile<ELFT>()->IsNeeded = true; if (auto *D = dyn_cast<Defined>(&B)) { - if (!D->Section) + auto *RelSec = dyn_cast_or_null<InputSectionBase>(D->Section); + if (!RelSec) return; uint64_t Offset = D->Value; if (D->isSection()) Offset += getAddend<ELFT>(Sec, Rel); - Fn(cast<InputSectionBase>(D->Section), Offset); + Fn(RelSec, Offset); return; } |