[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
Thu Jun 1 00:48:24 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL304392: [ELF] - Do not crash when proccessing absolute symbols during GC. (authored by grimar).

Changed prior to commit:
  https://reviews.llvm.org/D33713?vs=100835&id=100969#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D33713

Files:
  lld/trunk/ELF/MarkLive.cpp
  lld/trunk/test/ELF/gc-absolute.s


Index: lld/trunk/test/ELF/gc-absolute.s
===================================================================
--- lld/trunk/test/ELF/gc-absolute.s
+++ lld/trunk/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: lld/trunk/ELF/MarkLive.cpp
===================================================================
--- lld/trunk/ELF/MarkLive.cpp
+++ lld/trunk/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 = cast_or_null<InputSectionBase>(D->Section))
+        Enqueue({IS, D->Value});
   };
 
   // Add GC root symbols.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33713.100969.patch
Type: text/x-patch
Size: 853 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170601/10b04e5a/attachment.bin>


More information about the llvm-commits mailing list