[lld] 363b295 - [ELF] Support quoted symbol in the ENTRY command
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 25 12:19:49 PDT 2022
Author: Fangrui Song
Date: 2022-06-25T12:19:45-07:00
New Revision: 363b29567e29c52ffd70a4f1254213c83e0391c9
URL: https://github.com/llvm/llvm-project/commit/363b29567e29c52ffd70a4f1254213c83e0391c9
DIFF: https://github.com/llvm/llvm-project/commit/363b29567e29c52ffd70a4f1254213c83e0391c9.diff
LOG: [ELF] Support quoted symbol in the ENTRY command
This matches GNU ld and matches other places we unquote the symbol name.
Fixes #56208
Added:
Modified:
lld/ELF/ScriptParser.cpp
lld/test/ELF/linkerscript/entry.s
Removed:
################################################################################
diff --git a/lld/ELF/ScriptParser.cpp b/lld/ELF/ScriptParser.cpp
index 9a1e0d5263c4e..93988542d3bc8 100644
--- a/lld/ELF/ScriptParser.cpp
+++ b/lld/ELF/ScriptParser.cpp
@@ -351,7 +351,7 @@ void ScriptParser::readEntry() {
expect("(");
StringRef tok = next();
if (config->entry.empty())
- config->entry = tok;
+ config->entry = unquote(tok);
expect(")");
}
diff --git a/lld/test/ELF/linkerscript/entry.s b/lld/test/ELF/linkerscript/entry.s
index ecf052b3548a7..2e9b9af23f4b2 100644
--- a/lld/test/ELF/linkerscript/entry.s
+++ b/lld/test/ELF/linkerscript/entry.s
@@ -6,6 +6,10 @@
# RUN: ld.lld %t.script %t.o -o %t
# RUN: llvm-readelf -hs %t | FileCheck %s
+# RUN: echo 'ENTRY("_label")' > %t.script
+# RUN: ld.lld %t.script %t.o -o %t
+# RUN: llvm-readelf -hs %t | FileCheck %s
+
# CHECK: Entry point address: 0x[[#%x,ENTRY:]]
# CHECK: [[#]]: {{0*}}[[#ENTRY]] 0 NOTYPE GLOBAL DEFAULT [[#]] _label
More information about the llvm-commits
mailing list