[lld] r362218 - [ELF] Replace a dead test in getSymVA() with assert()

Hans Wennborg via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 25 08:49:32 PDT 2019


Reverted in r364321

On Fri, May 31, 2019 at 12:09 PM Fangrui Song via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
>
> Author: maskray
> Date: Fri May 31 03:12:22 2019
> New Revision: 362218
>
> URL: http://llvm.org/viewvc/llvm-project?rev=362218&view=rev
> Log:
> [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
>
> Modified:
>     lld/trunk/ELF/Symbols.cpp
>
> Modified: lld/trunk/ELF/Symbols.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.cpp?rev=362218&r1=362217&r2=362218&view=diff
> ==============================================================================
> --- lld/trunk/ELF/Symbols.cpp (original)
> +++ lld/trunk/ELF/Symbols.cpp Fri May 31 03:12:22 2019
> @@ -47,17 +47,11 @@ static uint64_t getSymVA(const Symbol &S
>      auto &D = cast<Defined>(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;
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list