[lld] r278663 - [ELF] Linkerscript: fix bug in assignOffsets (check Sym for non-null)

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 25 11:16:15 PDT 2016


testcase?

On 15 August 2016 at 05:19, Eugene Leviant via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> Author: evgeny777
> Date: Mon Aug 15 04:19:51 2016
> New Revision: 278663
>
> URL: http://llvm.org/viewvc/llvm-project?rev=278663&view=rev
> Log:
> [ELF] Linkerscript: fix bug in assignOffsets (check Sym for non-null)
>
> Modified:
>     lld/trunk/ELF/LinkerScript.cpp
>
> Modified: lld/trunk/ELF/LinkerScript.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=278663&r1=278662&r2=278663&view=diff
> ==============================================================================
> --- lld/trunk/ELF/LinkerScript.cpp (original)
> +++ lld/trunk/ELF/LinkerScript.cpp Mon Aug 15 04:19:51 2016
> @@ -319,8 +319,10 @@ template <class ELFT> void assignOffsets
>        uintX_t Value = L->Cmd->Expression(Sec->getVA() + Off) - Sec->getVA();
>        if (L->Cmd->Name == ".") {
>          Off = Value;
> -      } else {
> -        auto *Sym = cast<DefinedSynthetic<ELFT>>(L->Cmd->Sym);
> +      } else if (auto *Sym =
> +                     cast_or_null<DefinedSynthetic<ELFT>>(L->Cmd->Sym)) {
> +        // shouldDefine could have returned false, so we need to check Sym,
> +        // for non-null value.
>          Sym->Section = OutSec;
>          Sym->Value = Value;
>        }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list