LLD patch: Fix for LLD on linker scripts with empty sections

This reapplies 569cf286ff
to the embedded LLD.
This commit is contained in:
Andrew Kelley 2017-12-01 12:08:16 -05:00
parent 9ea23272fa
commit fa45407e78

View File

@ -751,7 +751,7 @@ void LinkerScript::adjustSectionsAfterSorting() {
if (auto *Cmd = dyn_cast<OutputSectionCommand>(Base)) {
Cmd->MemRegion = findMemoryRegion(Cmd);
// Handle align (e.g. ".foo : ALIGN(16) { ... }").
if (Cmd->AlignExpr)
if (Cmd->AlignExpr && Cmd->Sec)
Cmd->Sec->updateAlignment(Cmd->AlignExpr().getValue());
}
}