[PATCH] D60901: [LLD][ELF] - Handle quoted strings in the linker scripts correctly
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 22 00:55:30 PDT 2019
This revision was automatically updated to reflect the committed changes.
grimar marked an inline comment as done.
Closed by commit rL358874: [LLD][ELF] - Handle quoted strings in the linker scripts correctly. (authored by grimar, committed by ).
Herald added a project: LLVM.
Changed prior to commit:
https://reviews.llvm.org/D60901?vs=195871&id=196038#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60901/new/
https://reviews.llvm.org/D60901
Files:
lld/trunk/ELF/ScriptParser.cpp
lld/trunk/test/ELF/linkerscript/quoted-section-name.test
Index: lld/trunk/ELF/ScriptParser.cpp
===================================================================
--- lld/trunk/ELF/ScriptParser.cpp
+++ lld/trunk/ELF/ScriptParser.cpp
@@ -636,7 +636,7 @@
std::vector<StringRef> V;
while (!errorCount() && peek() != ")" && peek() != "EXCLUDE_FILE")
- V.push_back(next());
+ V.push_back(unquote(next()));
if (!V.empty())
Ret.push_back({std::move(ExcludeFilePat), StringMatcher(V)});
Index: lld/trunk/test/ELF/linkerscript/quoted-section-name.test
===================================================================
--- lld/trunk/test/ELF/linkerscript/quoted-section-name.test
+++ lld/trunk/test/ELF/linkerscript/quoted-section-name.test
@@ -0,0 +1,13 @@
+# REQUIRES: x86
+
+## Handling of quotes is tricky sometimes. Check we do that right and include
+## "foo bar" section into .data as expected.
+
+# RUN: echo '.section "foo bar", "aw"; nop' | llvm-mc -filetype=obj -triple=x86_64-pc-linux - -o %t
+# RUN: ld.lld %t --script %s -o %t2 --print-map | FileCheck %s
+# CHECK: .data
+# CHECK-NEXT: {{.*}}(foo bar)
+
+SECTIONS {
+ .data : { *("foo bar") }
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60901.196038.patch
Type: text/x-patch
Size: 1139 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190422/a1bec744/attachment.bin>
More information about the llvm-commits
mailing list