[lld] 9c16a4a - [ELF] INSERT [AFTER|BEFORE]: support quoted names
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 27 17:34:41 PDT 2024
Author: Fangrui Song
Date: 2024-07-27T17:34:37-07:00
New Revision: 9c16a4a2dc20dda1fc9517fb72d3cc79b62557aa
URL: https://github.com/llvm/llvm-project/commit/9c16a4a2dc20dda1fc9517fb72d3cc79b62557aa
DIFF: https://github.com/llvm/llvm-project/commit/9c16a4a2dc20dda1fc9517fb72d3cc79b62557aa.diff
LOG: [ELF] INSERT [AFTER|BEFORE]: support quoted names
Added:
Modified:
lld/ELF/ScriptParser.cpp
lld/test/ELF/linkerscript/insert-after.test
lld/test/ELF/linkerscript/insert-before.test
Removed:
################################################################################
diff --git a/lld/ELF/ScriptParser.cpp b/lld/ELF/ScriptParser.cpp
index 68047e446bc76..43b0e4fbe1ef0 100644
--- a/lld/ELF/ScriptParser.cpp
+++ b/lld/ELF/ScriptParser.cpp
@@ -660,7 +660,7 @@ void ScriptParser::readSections() {
isAfter = true;
else if (!consume("BEFORE"))
setError("expected AFTER/BEFORE, but got '" + next() + "'");
- StringRef where = next();
+ StringRef where = readName();
SmallVector<StringRef, 0> names;
for (SectionCommand *cmd : v)
if (auto *os = dyn_cast<OutputDesc>(cmd))
diff --git a/lld/test/ELF/linkerscript/insert-after.test b/lld/test/ELF/linkerscript/insert-after.test
index 4b25ff36806cf..38eb0481a10a9 100644
--- a/lld/test/ELF/linkerscript/insert-after.test
+++ b/lld/test/ELF/linkerscript/insert-after.test
@@ -41,7 +41,7 @@
SECTIONS { .byte : { BYTE(0) } } INSERT AFTER .data;
-SECTIONS { .foo.data : { *(.foo.data) } } INSERT AFTER .data;
+SECTIONS { .foo.data : { *(.foo.data) } } INSERT AFTER ".data";
## The input section .foo.text is an orphan. It will be placed in .foo.text
SECTIONS { .foo.text : {} } INSERT AFTER .text;
diff --git a/lld/test/ELF/linkerscript/insert-before.test b/lld/test/ELF/linkerscript/insert-before.test
index a72834988007c..f06c73327f088 100644
--- a/lld/test/ELF/linkerscript/insert-before.test
+++ b/lld/test/ELF/linkerscript/insert-before.test
@@ -50,4 +50,4 @@ SECTIONS { .byte : { BYTE(0) } } INSERT BEFORE .data;
SECTIONS { .foo.data : { *(.foo.data) } } INSERT BEFORE .data;
## The input section .foo.text is an orphan. It will be placed in .foo.text
-SECTIONS { .foo.text : { x0 = .; } } INSERT BEFORE .text;
+SECTIONS { .foo.text : { x0 = .; } } INSERT BEFORE ".text";
More information about the llvm-commits
mailing list