[PATCH] D33713: [ELF] - Do not crash when proccessing absolute symbols during GC.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 31 01:45:59 PDT 2017
grimar created this revision.
Herald added a subscriber: emaste.
This is PR33239, previously we segfault on given testcase.
https://reviews.llvm.org/D33713
Files:
ELF/MarkLive.cpp
test/ELF/gc-absolute.s
Index: test/ELF/gc-absolute.s
===================================================================
--- test/ELF/gc-absolute.s
+++ test/ELF/gc-absolute.s
@@ -0,0 +1,7 @@
+# REQUIRES: x86
+
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
+# RUN: ld.lld %t -o %t2 -shared --gc-sections
+
+.global foo
+foo = 0x123
Index: ELF/MarkLive.cpp
===================================================================
--- ELF/MarkLive.cpp
+++ ELF/MarkLive.cpp
@@ -220,7 +220,8 @@
auto MarkSymbol = [&](const SymbolBody *Sym) {
if (auto *D = dyn_cast_or_null<DefinedRegular>(Sym))
- Enqueue({cast<InputSectionBase>(D->Section), D->Value});
+ if (auto *IS = dyn_cast_or_null<InputSectionBase>(D->Section))
+ Enqueue({IS, D->Value});
};
// Add GC root symbols.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33713.100835.patch
Type: text/x-patch
Size: 797 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170531/fe8fd9fc/attachment.bin>
More information about the llvm-commits
mailing list