[PATCH] D41095: ELF: Do not follow relocation edges to output sections during GC.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 11 14:48:22 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL320431: ELF: Do not follow relocation edges to output sections during GC. (authored by pcc).

Changed prior to commit:
  https://reviews.llvm.org/D41095?vs=126451&id=126452#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D41095

Files:
  lld/trunk/ELF/MarkLive.cpp
  lld/trunk/test/ELF/gc-sections-linker-defined-symbol.s


Index: lld/trunk/test/ELF/gc-sections-linker-defined-symbol.s
===================================================================
--- lld/trunk/test/ELF/gc-sections-linker-defined-symbol.s
+++ lld/trunk/test/ELF/gc-sections-linker-defined-symbol.s
@@ -13,4 +13,6 @@
 # CHECK-NEXT: Section: .dynamic
 
         .data
+        .globl g
+        g:
         .quad _end
Index: lld/trunk/ELF/MarkLive.cpp
===================================================================
--- lld/trunk/ELF/MarkLive.cpp
+++ lld/trunk/ELF/MarkLive.cpp
@@ -71,12 +71,13 @@
       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;
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41095.126452.patch
Type: text/x-patch
Size: 962 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171211/68e72040/attachment.bin>


More information about the llvm-commits mailing list