[lld] r248919 - ELF2: LinkerScript: Handle quoted tokens.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 30 10:15:29 PDT 2015


Author: ruiu
Date: Wed Sep 30 12:15:29 2015
New Revision: 248919

URL: http://llvm.org/viewvc/llvm-project?rev=248919&view=rev
Log:
ELF2: LinkerScript: Handle quoted tokens.

Modified:
    lld/trunk/ELF/DriverUtils.cpp
    lld/trunk/test/elf2/basic.s

Modified: lld/trunk/ELF/DriverUtils.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/DriverUtils.cpp?rev=248919&r1=248918&r2=248919&view=diff
==============================================================================
--- lld/trunk/ELF/DriverUtils.cpp (original)
+++ lld/trunk/ELF/DriverUtils.cpp Wed Sep 30 12:15:29 2015
@@ -125,6 +125,18 @@ std::vector<StringRef> LinkerScript::tok
     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_.$/\\~=+[]*?-:");

Modified: lld/trunk/test/elf2/basic.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/basic.s?rev=248919&r1=248918&r2=248919&view=diff
==============================================================================
--- lld/trunk/test/elf2/basic.s (original)
+++ lld/trunk/test/elf2/basic.s Wed Sep 30 12:15:29 2015
@@ -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




More information about the llvm-commits mailing list