Commit fa45407e78

Andrew Kelley <superjoe30@gmail.com>
2017-12-01 18:08:16
LLD patch: Fix for LLD on linker scripts with empty sections
This reapplies 569cf286ff79a10126b9f20f39fa8c64df9b8b25 to the embedded LLD.
1 parent 9ea2327
Changed files (1)
deps
deps/lld/ELF/LinkerScript.cpp
@@ -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());
     }
   }