[ELF] Handle output section alignment in linker scripts
LLD already parses ALIGN expression to specifiy alignment for output
sections in linker scripts but it never applies the alignment to the
output section. This change handles that.
Differential Revision: https://reviews.llvm.org/D29689
llvm-svn: 294374
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index 7b6f449..c6b9009 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -557,6 +557,10 @@
if (!Sec)
return;
+ // Handle align (e.g. ".foo : ALIGN(16) { ... }").
+ if (Cmd->AlignExpr)
+ Sec->updateAlignment(Cmd->AlignExpr(0));
+
// Try and find an appropriate memory region to assign offsets in.
CurMemRegion = findMemoryRegion(Cmd, Sec);
if (CurMemRegion)