[lld] a4921f1 - [ELF] Output section phdr: support quoted names
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 27 17:40:56 PDT 2024
Author: Fangrui Song
Date: 2024-07-27T17:40:51-07:00
New Revision: a4921f10e09e9aab9aad555115bfe43fe12af29c
URL: https://github.com/llvm/llvm-project/commit/a4921f10e09e9aab9aad555115bfe43fe12af29c
DIFF: https://github.com/llvm/llvm-project/commit/a4921f10e09e9aab9aad555115bfe43fe12af29c.diff
LOG: [ELF] Output section phdr: support quoted names
Added:
Modified:
lld/ELF/ScriptParser.cpp
lld/test/ELF/linkerscript/phdrs.s
Removed:
################################################################################
diff --git a/lld/ELF/ScriptParser.cpp b/lld/ELF/ScriptParser.cpp
index 43b0e4fbe1ef0..c033733877093 100644
--- a/lld/ELF/ScriptParser.cpp
+++ b/lld/ELF/ScriptParser.cpp
@@ -1643,7 +1643,7 @@ SmallVector<StringRef, 0> ScriptParser::readOutputSectionPhdrs() {
SmallVector<StringRef, 0> phdrs;
while (!errorCount() && peek().starts_with(":")) {
StringRef tok = next();
- phdrs.push_back((tok.size() == 1) ? next() : tok.substr(1));
+ phdrs.push_back((tok.size() == 1) ? readName() : tok.substr(1));
}
return phdrs;
}
diff --git a/lld/test/ELF/linkerscript/phdrs.s b/lld/test/ELF/linkerscript/phdrs.s
index 96a8b29e6769c..997f7e39972d2 100644
--- a/lld/test/ELF/linkerscript/phdrs.s
+++ b/lld/test/ELF/linkerscript/phdrs.s
@@ -7,8 +7,8 @@ PHDRS {all PT_LOAD FILEHDR PHDRS ;}
SECTIONS {
. = 0x10000200;
.text : {*(.text*)} :all
- .foo : {*(.foo.*)} :all
- .data : {*(.data.*)} :all}
+ .foo : {*(.foo.*)} :"all"
+ .data : {*(.data.*)} : "all"}
# RUN: ld.lld -o 1 -T 1.lds a.o
# RUN: llvm-readelf -Sl 1 | FileCheck %s
More information about the llvm-commits
mailing list