[PATCH] D116475: [JITLink] Add anonymous symbols in LinkGraph for unnamed temporary symbols
luxufan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Jan 1 07:08:51 PST 2022
StephenFan created this revision.
StephenFan added a reviewer: lhames.
Herald added subscribers: luke957, luismarques, s.egerton, PkmX, simoncook, hiraditya.
StephenFan requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
In RISCV, temporary symbols will be used to generate dwarf, eh_frame sections..., and will be placed in object code's symbol table. However, LLVM does not use names on these temporary symbols. This patch add anonymous symbols in LinkGraph for these temporary symbols.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D116475
Files:
llvm/lib/ExecutionEngine/JITLink/ELFLinkGraphBuilder.h
Index: llvm/lib/ExecutionEngine/JITLink/ELFLinkGraphBuilder.h
===================================================================
--- llvm/lib/ExecutionEngine/JITLink/ELFLinkGraphBuilder.h
+++ llvm/lib/ExecutionEngine/JITLink/ELFLinkGraphBuilder.h
@@ -444,9 +444,16 @@
if (Sym.getType() == ELF::STT_SECTION)
*Name = GraphSec->getName();
+ // In RISCV, temporary symbols (Used to generate dwarf, eh_frame
+ // sections...) will appear in object code's symbol table, and LLVM does
+ // not use names on these temporary symbols (RISCV gnu toolchain uses
+ // names on these temporary symbols).
auto &GSym =
- G->addDefinedSymbol(*B, Sym.getValue(), *Name, Sym.st_size, L, S,
- Sym.getType() == ELF::STT_FUNC, false);
+ Name->empty()
+ ? G->addAnonymousSymbol(*B, Sym.getValue(), Sym.st_size,
+ Sym.getType() == ELF::STT_FUNC, false)
+ : G->addDefinedSymbol(*B, Sym.getValue(), *Name, Sym.st_size, L,
+ S, Sym.getType() == ELF::STT_FUNC, false);
setGraphSymbol(SymIndex, GSym);
}
} else if (Sym.isUndefined() && Sym.isExternal()) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116475.396857.patch
Type: text/x-patch
Size: 1267 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220101/428bc2e0/attachment.bin>
More information about the llvm-commits
mailing list