mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-29 10:25:12 +00:00
[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
This commit is contained in:
@@ -187,4 +187,16 @@ TEST_F(MCJITTest, multiple_functions) {
|
||||
|
||||
#endif /*!defined(__arm__)*/
|
||||
|
||||
TEST_F(MCJITTest, multiple_decl_lookups) {
|
||||
SKIP_UNSUPPORTED_PLATFORM;
|
||||
|
||||
Function *Foo = insertExternalReferenceToFunction<void(void)>(M.get(), "_exit");
|
||||
createJIT(std::move(M));
|
||||
void *A = TheJIT->getPointerToFunction(Foo);
|
||||
void *B = TheJIT->getPointerToFunction(Foo);
|
||||
|
||||
EXPECT_TRUE(A != 0) << "Failed lookup - test not correctly configured.";
|
||||
EXPECT_EQ(A, B) << "Repeat calls to getPointerToFunction fail.";
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user