[lld] r278663 - [ELF] Linkerscript: fix bug in assignOffsets (check Sym for non-null)
Eugene Leviant via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 15 02:19:52 PDT 2016
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;
}
More information about the llvm-commits
mailing list