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

llvm-svn: 278663
This commit is contained in:
Eugene Leviant 2016-08-15 09:19:51 +00:00
parent b3d1290c44
commit b6f1bb13ae
1 changed files with 4 additions and 2 deletions

View File

@ -319,8 +319,10 @@ template <class ELFT> void assignOffsets(OutputSectionBase<ELFT> *Sec) {
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;
}