From 3f29cfd91545594e8a5d018e8d82a9d6bccd341d Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Fri, 31 May 2019 10:12:22 +0000 Subject: [PATCH] [ELF] Replace a dead test in getSymVA() with assert() Symbols relative to discarded comdat sections are Undefined instead of Defined now (after D59649 and D61583). The `== &InputSection::Discarded` test becomes dead. I cannot find a test related to this behavior. Reviewed By: ruiu Differential Revision: https://reviews.llvm.org/D62725 llvm-svn: 362218 --- lld/ELF/Symbols.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/lld/ELF/Symbols.cpp b/lld/ELF/Symbols.cpp index e82d1ac1fdf6..8246efcaf108 100644 --- a/lld/ELF/Symbols.cpp +++ b/lld/ELF/Symbols.cpp @@ -47,17 +47,11 @@ static uint64_t getSymVA(const Symbol &Sym, int64_t &Addend) { auto &D = cast(Sym); SectionBase *IS = D.Section; - // According to the ELF spec reference to a local symbol from outside - // the group are not allowed. Unfortunately .eh_frame breaks that rule - // and must be treated specially. For now we just replace the symbol with - // 0. - if (IS == &InputSection::Discarded) - return 0; - // This is an absolute symbol. if (!IS) return D.Value; + assert(IS != &InputSection::Discarded); IS = IS->Repl; uint64_t Offset = D.Value;