File tree 2 files changed +30
-1
lines changed
2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -1736,7 +1736,14 @@ Expr ScriptParser::readPrimary() {
1736
1736
if (Tok == " ASSERT" )
1737
1737
return readAssert ();
1738
1738
if (Tok == " ALIGN" ) {
1739
- Expr E = readParenExpr ();
1739
+ expect (" (" );
1740
+ Expr E = readExpr ();
1741
+ if (consume (" ," )) {
1742
+ Expr E2 = readExpr ();
1743
+ expect (" )" );
1744
+ return [=](uint64_t Dot) { return alignTo (E (Dot), E2 (Dot)); };
1745
+ }
1746
+ expect (" )" );
1740
1747
return [=](uint64_t Dot) { return alignTo (Dot, E (Dot)); };
1741
1748
}
1742
1749
if (Tok == " CONSTANT" ) {
Original file line number Diff line number Diff line change 21
21
# RUN: }" > %t.script
22
22
# RUN: ld.lld -o %t1 --script %t.script %t
23
23
# RUN: llvm-objdump -section-headers %t1 | FileCheck %s
24
+
25
+ ## Check that the two argument version of ALIGN command works
26
+ # RUN: echo "SECTIONS { \
27
+ # RUN: . = ALIGN(0x1234, 0x10000); \
28
+ # RUN: .aaa : \
29
+ # RUN: { \
30
+ # RUN: *(.aaa) \
31
+ # RUN: } \
32
+ # RUN: . = ALIGN(., 4096); \
33
+ # RUN: .bbb : \
34
+ # RUN: { \
35
+ # RUN: *(.bbb) \
36
+ # RUN: } \
37
+ # RUN: . = ALIGN(., 4096 * 4); \
38
+ # RUN: .ccc : \
39
+ # RUN: { \
40
+ # RUN: *(.ccc) \
41
+ # RUN: } \
42
+ # RUN: }" > %t.script
43
+ # RUN: ld.lld -o %t1 --script %t.script %t
44
+ # RUN: llvm-objdump -section-headers %t1 | FileCheck %s
45
+
24
46
# CHECK: Sections:
25
47
# CHECK-NEXT: Idx Name Size Address Type
26
48
# CHECK-NEXT: 0 00000000 0000000000000000
You can’t perform that action at this time.
0 commit comments