[PATCH] D149541: [JITLink] Process null symbols
Job Noorman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 16 00:25:56 PDT 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6c06a079365d: [JITLink] Process null symbols (authored by jobnoorman).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D149541/new/
https://reviews.llvm.org/D149541
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
@@ -540,6 +540,21 @@
auto &GSym = G->addExternalSymbol(*Name, Sym.st_size,
Sym.getBinding() == ELF::STB_WEAK);
setGraphSymbol(SymIndex, GSym);
+ } else if (Sym.isUndefined() && Sym.st_value == 0 && Sym.st_size == 0 &&
+ Sym.getType() == ELF::STT_NOTYPE &&
+ Sym.getBinding() == ELF::STB_LOCAL && Name->empty()) {
+ // Some relocations (e.g., R_RISCV_ALIGN) don't have a target symbol and
+ // use this kind of null symbol as a placeholder.
+ LLVM_DEBUG({
+ dbgs() << " " << SymIndex << ": Creating null graph symbol\n";
+ });
+
+ auto SymName =
+ G->allocateContent("__jitlink_ELF_SYM_UND_" + Twine(SymIndex));
+ auto SymNameRef = StringRef(SymName.data(), SymName.size());
+ auto &GSym = G->addAbsoluteSymbol(SymNameRef, orc::ExecutorAddr(0), 0,
+ Linkage::Strong, Scope::Local, false);
+ setGraphSymbol(SymIndex, GSym);
} else {
LLVM_DEBUG({
dbgs() << " " << SymIndex
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149541.522465.patch
Type: text/x-patch
Size: 1330 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230516/a9136167/attachment.bin>
More information about the llvm-commits
mailing list