diff options
| author | George Rimar <grimar@accesssoftek.com> | 2019-04-22 07:57:07 +0000 |
|---|---|---|
| committer | George Rimar <grimar@accesssoftek.com> | 2019-04-22 07:57:07 +0000 |
| commit | f902250fc13bdcd2dbdb733304f1eed743613eb9 (patch) | |
| tree | bcad06c507c490a4391064d6af2c5191a4e2adda | |
| parent | ee12a75e388a695ab0b4643a5fbad21ec537a65f (diff) | |
| download | bcm5719-llvm-f902250fc13bdcd2dbdb733304f1eed743613eb9.tar.gz bcm5719-llvm-f902250fc13bdcd2dbdb733304f1eed743613eb9.zip | |
[LLD][ELF] - Handle quoted strings in the linker scripts correctly.
This is the https://bugs.llvm.org/show_bug.cgi?id=41356,
Seems it is kind of unusual case but it is possible to
have sections that require quotes for their namings.
Like "aaa bbb".
This patch adds support for those.
Differential revision: https://reviews.llvm.org/D60901
llvm-svn: 358874
| -rw-r--r-- | lld/ELF/ScriptParser.cpp | 2 | ||||
| -rw-r--r-- | lld/test/ELF/linkerscript/quoted-section-name.test | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/lld/ELF/ScriptParser.cpp b/lld/ELF/ScriptParser.cpp index d757cd28c46..9e534c5efe7 100644 --- a/lld/ELF/ScriptParser.cpp +++ b/lld/ELF/ScriptParser.cpp @@ -636,7 +636,7 @@ std::vector<SectionPattern> ScriptParser::readInputSectionsList() { 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)}); diff --git a/lld/test/ELF/linkerscript/quoted-section-name.test b/lld/test/ELF/linkerscript/quoted-section-name.test new file mode 100644 index 00000000000..aa675759631 --- /dev/null +++ b/lld/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") } +} |

