diff options
author | Lang Hames <lhames@gmail.com> | 2014-10-22 23:18:42 +0000 |
---|---|---|
committer | Lang Hames <lhames@gmail.com> | 2014-10-22 23:18:42 +0000 |
commit | 950c6482c6a4904fd8ae26610af5cec4fd8abd17 (patch) | |
tree | c3c60af2845403bd5c6922d6760b58c455656628 /lib/ExecutionEngine/MCJIT | |
parent | ae3811c355bfcf37d2c3573038b3ac216fee89f0 (diff) |
[MCJIT] Make repeat calls to MCJIT::getPointerToFunction for declarations safe.
MCJIT::getPointerForFunction adds the resulting address to the global mapping.
This should be done via updateGlobalMapping rather than addGlobalMapping, since
the latter asserts if a mapping already exists.
MCJIT::getPointerToFunction is actually deprecated - hopefully we can remove it
(or more likely re-task it) entirely soon. In the mean time it should at least
work as advertised.
<rdar://problem/18727946>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220444 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine/MCJIT')
-rw-r--r-- | lib/ExecutionEngine/MCJIT/MCJIT.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/ExecutionEngine/MCJIT/MCJIT.cpp b/lib/ExecutionEngine/MCJIT/MCJIT.cpp index 9469d108e2e..8f1662f6ee7 100644 --- a/lib/ExecutionEngine/MCJIT/MCJIT.cpp +++ b/lib/ExecutionEngine/MCJIT/MCJIT.cpp @@ -357,7 +357,7 @@ void *MCJIT::getPointerToFunction(Function *F) { if (F->isDeclaration() || F->hasAvailableExternallyLinkage()) { bool AbortOnFailure = !F->hasExternalWeakLinkage(); void *Addr = getPointerToNamedFunction(Name, AbortOnFailure); - addGlobalMapping(F, Addr); + updateGlobalMapping(F, Addr); return Addr; } |