[ELF] - Linkerscript: Implement two argument version of ALIGN()
Fixes http://llvm.org/PR31129
Patch by Alexander Richardson!
Differential Revision: https://reviews.llvm.org/D27848
llvm-svn: 289968
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index 81498b2..7387c9c 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -1736,7 +1736,14 @@
if (Tok == "ASSERT")
return readAssert();
if (Tok == "ALIGN") {
- Expr E = readParenExpr();
+ expect("(");
+ Expr E = readExpr();
+ if (consume(",")) {
+ Expr E2 = readExpr();
+ expect(")");
+ return [=](uint64_t Dot) { return alignTo(E(Dot), E2(Dot)); };
+ }
+ expect(")");
return [=](uint64_t Dot) { return alignTo(Dot, E(Dot)); };
}
if (Tok == "CONSTANT") {