File tree 2 files changed +12
-5
lines changed
2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -1043,8 +1043,7 @@ SymbolAssignment *ScriptParser::readAssignment(StringRef tok) {
1043
1043
// Support = followed by an expression without whitespace.
1044
1044
SaveAndRestore<bool > saved (inExpr, true );
1045
1045
cmd = readSymbolAssignment (tok);
1046
- } else if ((op.size () == 2 && op[1 ] == ' =' &&
1047
- is_contained (" */+-&|" , op[0 ])) ||
1046
+ } else if ((op.size () == 2 && op[1 ] == ' =' && strchr (" */+-&|" , op[0 ])) ||
1048
1047
op == " <<=" || op == " >>=" ) {
1049
1048
cmd = readSymbolAssignment (tok);
1050
1049
} else if (tok == " PROVIDE" ) {
Original file line number Diff line number Diff line change 5
5
6
6
SECTIONS {
7
7
_start = .;
8
- unary =!0 + !0;
8
+ unary =!0 + !0; # Test space can be omitted between = and !
9
9
negate =-1 - 1;
10
10
not =~0xffff + 4;
11
11
not_negate = -~5 + 1;
@@ -28,9 +28,9 @@ SECTIONS {
28
28
ternary2 = 1 ? 2?3:4 : 5?6 :7;
29
29
30
30
mulassign =2;
31
- mulassign *= 2;
31
+ mulassign *=2; # Test space can be omitted after *=
32
32
divassign = 8;
33
- divassign /= 2;
33
+ divassign /=2;
34
34
plusassign =1;
35
35
plusassign += 2;
36
36
minusassign = 3;
@@ -160,3 +160,11 @@ SECTIONS {
160
160
## Div by zero error.
161
161
# RUN: echo 'a = 1; a /= 0;' > %t.script
162
162
# RUN: not ld.lld %t.o -T %t.script -o /dev/null 2>&1 | FileCheck --check-prefix=DIVZERO %s
163
+
164
+ ## GNU ld does not support %= or ^=.
165
+ # RUN: echo 'a = 1; a %= 0;' > %t.script
166
+ # RUN: not ld.lld %t.o -T %t.script -o /dev/null 2>&1 | FileCheck --check-prefix=UNKNOWN %s
167
+ # RUN: echo 'a = 1; a ^= 0;' > %t.script
168
+ # RUN: not ld.lld %t.o -T %t.script -o /dev/null 2>&1 | FileCheck --check-prefix=UNKNOWN %s
169
+
170
+ # UNKNOWN: error: {{.*}}:1: unknown directive: a
You can’t perform that action at this time.
0 commit comments