[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:41:40 PST 2017
pcc created this revision.
Herald added a subscriber: emaste.
This fixes an assertion error introduced by r320390.
https://reviews.llvm.org/D41095
Files:
lld/ELF/MarkLive.cpp
lld/test/ELF/gc-sections-linker-defined-symbol.s
Index: lld/test/ELF/gc-sections-linker-defined-symbol.s
===================================================================
--- lld/test/ELF/gc-sections-linker-defined-symbol.s
+++ lld/test/ELF/gc-sections-linker-defined-symbol.s
@@ -13,4 +13,6 @@
# CHECK-NEXT: Section: .dynamic
.data
+ .globl g
+ g:
.quad _end
Index: lld/ELF/MarkLive.cpp
===================================================================
--- lld/ELF/MarkLive.cpp
+++ lld/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.126451.patch
Type: text/x-patch
Size: 926 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171211/54114896/attachment.bin>
More information about the llvm-commits
mailing list