ELF2: LinkerScript: Handle quoted tokens.
llvm-svn: 248919
diff --git a/lld/ELF/DriverUtils.cpp b/lld/ELF/DriverUtils.cpp
index 516084c..cf97c93 100644
--- a/lld/ELF/DriverUtils.cpp
+++ b/lld/ELF/DriverUtils.cpp
@@ -125,6 +125,18 @@
S = skipSpace(S);
if (S.empty())
return Ret;
+
+ // Quoted token
+ if (S.startswith("\"")) {
+ size_t E = S.find("\"", 1);
+ if (E == StringRef::npos)
+ error("unclosed quote");
+ Ret.push_back(S.substr(1, E));
+ S = S.substr(E + 1);
+ continue;
+ }
+
+ // Unquoted token
size_t Pos = S.find_first_not_of(
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
"0123456789_.$/\\~=+[]*?-:");
diff --git a/lld/test/elf2/basic.s b/lld/test/elf2/basic.s
index 40a381f..39da296 100644
--- a/lld/test/elf2/basic.s
+++ b/lld/test/elf2/basic.s
@@ -190,7 +190,7 @@
# RUN: llvm-readobj -file-headers -sections -program-headers -symbols %t2 \
# RUN: | FileCheck %s
-# RUN: echo "OUTPUT_FORMAT(elf64-x86-64) /*/*/ GROUP(" %t ")" > %t.script
+# RUN: echo "OUTPUT_FORMAT(\"elf64-x86-64\") /*/*/ GROUP(" %t ")" > %t.script
# RUN: lld -flavor gnu2 -o %t2 %t.script
# RUN: llvm-readobj -file-headers -sections -program-headers -symbols %t2 \
# RUN: | FileCheck %s