diff options
| author | Rui Ueyama <ruiu@google.com> | 2015-09-30 17:15:29 +0000 |
|---|---|---|
| committer | Rui Ueyama <ruiu@google.com> | 2015-09-30 17:15:29 +0000 |
| commit | bf506b7d48b8d7e465ae6260cf51fec4e1788481 (patch) | |
| tree | 170e47ac224b1946731cabb0d9a99cf8f58fc720 | |
| parent | f5c4aca98f9476d452e8630d29de14e0765a03b0 (diff) | |
| download | bcm5719-llvm-bf506b7d48b8d7e465ae6260cf51fec4e1788481.tar.gz bcm5719-llvm-bf506b7d48b8d7e465ae6260cf51fec4e1788481.zip | |
ELF2: LinkerScript: Handle quoted tokens.
llvm-svn: 248919
| -rw-r--r-- | lld/ELF/DriverUtils.cpp | 12 | ||||
| -rw-r--r-- | lld/test/elf2/basic.s | 2 |
2 files changed, 13 insertions, 1 deletions
diff --git a/lld/ELF/DriverUtils.cpp b/lld/ELF/DriverUtils.cpp index 516084c1a6c..cf97c931272 100644 --- a/lld/ELF/DriverUtils.cpp +++ b/lld/ELF/DriverUtils.cpp @@ -125,6 +125,18 @@ std::vector<StringRef> LinkerScript::tokenize(StringRef S) { 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 40a381f5bcb..39da296a267 100644 --- a/lld/test/elf2/basic.s +++ b/lld/test/elf2/basic.s @@ -190,7 +190,7 @@ _start: # 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 |

