[lld] [ELF] Reject error-prone meta characters in input section description (PR #84130)

Peter Smith via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 6 02:15:04 PST 2024


================
@@ -717,9 +717,19 @@ SmallVector<SectionPattern, 0> ScriptParser::readInputSectionsList() {
 
     StringMatcher SectionMatcher;
     // Break if the next token is ), EXCLUDE_FILE, or SORT*.
-    while (!errorCount() && peek() != ")" && peek() != "EXCLUDE_FILE" &&
-           peekSortKind() == SortSectionPolicy::Default)
+    while (!errorCount() && peekSortKind() == SortSectionPolicy::Default) {
+      StringRef s = peek();
+      if (s == ")" || s == "EXCLUDE_FILE")
+        break;
+      // Detect common mistakes that certain non-wildcard meta characters used
----------------
smithp35 wrote:

Suggest
// Detect common mistakes when certain non-wildcard meta characters are used without a closing `)`


https://github.com/llvm/llvm-project/pull/84130


More information about the llvm-commits mailing list