Commit 569cf286ff

Andrea Orru <andreaorru1991@gmail.com>
2017-10-04 15:24:06
Fix for LLD on linker scripts with empty sections
1 parent 522b431
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());
     }
   }