Skip to content

Commit 35c9072

Browse files
committed
[JITLink] Fix access of moved-from argument in 265d6bd.
The LinkGraph that is passed into the ELFJITLinker_x86_64 constructor is handed off to the JITLinker base class, so can't be used in the constructor body. This commit adds a getGraph method to JITLinker, and updates ELFJITLinker_x86_64 to use that.
1 parent 265d6bd commit 35c9072

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ class ELFJITLinker_x86_64 : public JITLinker<ELFJITLinker_x86_64> {
243243
PassConfiguration PassConfig)
244244
: JITLinker(std::move(Ctx), std::move(G), std::move(PassConfig)) {
245245

246-
if (shouldAddDefaultTargetPasses(G->getTargetTriple()))
246+
if (shouldAddDefaultTargetPasses(getGraph().getTargetTriple()))
247247
getPassConfig().PostAllocationPasses.push_back(
248248
[this](LinkGraph &G) { return getOrCreateGOTSymbol(G); });
249249
}

llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ class JITLinkerBase {
4343
using AllocResult = Expected<std::unique_ptr<InFlightAlloc>>;
4444
using FinalizeResult = Expected<JITLinkMemoryManager::FinalizedAlloc>;
4545

46+
// Returns a reference to the graph being linked.
47+
LinkGraph &getGraph() { return *G; }
48+
4649
// Returns true if the context says that the linker should add default
4750
// passes. This can be used by JITLinkerBase implementations when deciding
4851
// whether they should add default passes.

0 commit comments

Comments
 (0)