summaryrefslogtreecommitdiff
path: root/lld/ELF/MarkLive.cpp
diff options
context:
space:
mode:
authorGeorge Rimar <grimar@accesssoftek.com>2017-06-01 07:47:56 +0000
committerGeorge Rimar <grimar@accesssoftek.com>2017-06-01 07:47:56 +0000
commitb429e398f20bd2a1b34743512422fa3a48ae9757 (patch)
tree563597881ee360be638713bf44b68d5a885418ef /lld/ELF/MarkLive.cpp
parentb4a59cbaf1fb74e2ed605aa7f7243ff72612c64d (diff)
[ELF] - Do not crash when proccessing absolute symbols during GC.
This is PR33239, previously we segfault on given testcase. Differential revision: https://reviews.llvm.org/D33713
Diffstat (limited to 'lld/ELF/MarkLive.cpp')
-rw-r--r--lld/ELF/MarkLive.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lld/ELF/MarkLive.cpp b/lld/ELF/MarkLive.cpp
index ee499265886..b77c84ff75a 100644
--- a/lld/ELF/MarkLive.cpp
+++ b/lld/ELF/MarkLive.cpp
@@ -220,7 +220,8 @@ template <class ELFT> void elf::markLive() {
auto MarkSymbol = [&](const SymbolBody *Sym) {
if (auto *D = dyn_cast_or_null<DefinedRegular>(Sym))
- Enqueue({cast<InputSectionBase>(D->Section), D->Value});
+ if (auto *IS = cast_or_null<InputSectionBase>(D->Section))
+ Enqueue({IS, D->Value});
};
// Add GC root symbols.