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(Sym)) - Enqueue({cast(D->Section), D->Value}); + if (auto *IS = dyn_cast_or_null(D->Section)) + Enqueue({IS, D->Value}); }; // Add GC root symbols. 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