Skip to content

Commit 77295c5

Browse files
committed
[ELF] Allow ? without adjacent space
GNU ld allows 1 ? 2?3:4 : 5?6 :7
1 parent e3f3d2a commit 77295c5

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lld/ELF/ScriptLexer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ bool ScriptLexer::atEOF() { return errorCount() || tokens.size() == pos; }
192192
// Split a given string as an expression.
193193
// This function returns "3", "*" and "5" for "3*5" for example.
194194
static std::vector<StringRef> tokenizeExpr(StringRef s) {
195-
StringRef ops = "+-*/:!~=<>"; // List of operators
195+
StringRef ops = "!~*/+-<>?:="; // List of operators
196196

197197
// Quoted strings are literal strings, so we don't want to split it.
198198
if (s.startswith("\""))

lld/test/ELF/linkerscript/operators.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ SECTIONS {
2525
logicalor = (0 || 0) + (0||1)*2 + (1|| 0)*4 + (1 ||1) *8;
2626
logicalor2 = 0 && 0 || 1 && 1;
2727
ternary1 = 0 ? 1 : 2 & 6;
28-
ternary2 = 1 ? 2 ? 3 : 4 : 5 ? 6 : 7;
28+
ternary2 = 1 ? 2?3:4 : 5?6 :7;
2929

3030
plusassign =1;
3131
plusassign += 2;

0 commit comments

Comments
 (0)