[lld] 77295c5 - [ELF] Allow ? without adjacent space
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 25 21:17:03 PDT 2022
Author: Fangrui Song
Date: 2022-06-25T21:16:59-07:00
New Revision: 77295c5486e48a4319efcfc4ac262304c7e7025c
URL: https://github.com/llvm/llvm-project/commit/77295c5486e48a4319efcfc4ac262304c7e7025c
DIFF: https://github.com/llvm/llvm-project/commit/77295c5486e48a4319efcfc4ac262304c7e7025c.diff
LOG: [ELF] Allow ? without adjacent space
GNU ld allows 1 ? 2?3:4 : 5?6 :7
Added:
Modified:
lld/ELF/ScriptLexer.cpp
lld/test/ELF/linkerscript/operators.test
Removed:
################################################################################
diff --git a/lld/ELF/ScriptLexer.cpp b/lld/ELF/ScriptLexer.cpp
index 8b1a510f6d91..6f9ffb790eec 100644
--- a/lld/ELF/ScriptLexer.cpp
+++ b/lld/ELF/ScriptLexer.cpp
@@ -192,7 +192,7 @@ bool ScriptLexer::atEOF() { return errorCount() || tokens.size() == pos; }
// Split a given string as an expression.
// This function returns "3", "*" and "5" for "3*5" for example.
static std::vector<StringRef> tokenizeExpr(StringRef s) {
- StringRef ops = "+-*/:!~=<>"; // List of operators
+ StringRef ops = "!~*/+-<>?:="; // List of operators
// Quoted strings are literal strings, so we don't want to split it.
if (s.startswith("\""))
diff --git a/lld/test/ELF/linkerscript/operators.test b/lld/test/ELF/linkerscript/operators.test
index 438229c26edf..2480dad4af46 100644
--- a/lld/test/ELF/linkerscript/operators.test
+++ b/lld/test/ELF/linkerscript/operators.test
@@ -25,7 +25,7 @@ SECTIONS {
logicalor = (0 || 0) + (0||1)*2 + (1|| 0)*4 + (1 ||1) *8;
logicalor2 = 0 && 0 || 1 && 1;
ternary1 = 0 ? 1 : 2 & 6;
- ternary2 = 1 ? 2 ? 3 : 4 : 5 ? 6 : 7;
+ ternary2 = 1 ? 2?3:4 : 5?6 :7;
plusassign =1;
plusassign += 2;
More information about the llvm-commits
mailing list