diff options
| author | Peter Collingbourne <peter@pcc.me.uk> | 2017-12-11 22:47:43 +0000 |
|---|---|---|
| committer | Peter Collingbourne <peter@pcc.me.uk> | 2017-12-11 22:47:43 +0000 |
| commit | 17f71de70be288f05e697a30d95fe9d9156a360e (patch) | |
| tree | de8ebfb25fe42a0d3e72dbc0079ee4ee6cd45f94 | |
| parent | 9c8d7f8dccd88044458121748dbad5d2f875030f (diff) | |
| download | bcm5719-llvm-17f71de70be288f05e697a30d95fe9d9156a360e.tar.gz bcm5719-llvm-17f71de70be288f05e697a30d95fe9d9156a360e.zip | |
ELF: Do not follow relocation edges to output sections during GC.
This fixes an assertion error introduced by r320390.
Differential Revision: https://reviews.llvm.org/D41095
llvm-svn: 320431
| -rw-r--r-- | lld/ELF/MarkLive.cpp | 5 | ||||
| -rw-r--r-- | lld/test/ELF/gc-sections-linker-defined-symbol.s | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/lld/ELF/MarkLive.cpp b/lld/ELF/MarkLive.cpp index fbf57a9ee2d..36f994f2049 100644 --- a/lld/ELF/MarkLive.cpp +++ b/lld/ELF/MarkLive.cpp @@ -71,12 +71,13 @@ static void resolveReloc(InputSectionBase &Sec, RelT &Rel, 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; } diff --git a/lld/test/ELF/gc-sections-linker-defined-symbol.s b/lld/test/ELF/gc-sections-linker-defined-symbol.s index 8720b845091..796f7b36355 100644 --- a/lld/test/ELF/gc-sections-linker-defined-symbol.s +++ b/lld/test/ELF/gc-sections-linker-defined-symbol.s @@ -13,4 +13,6 @@ # CHECK-NEXT: Section: .dynamic .data + .globl g + g: .quad _end |

