diff options
author | dim <dim@FreeBSD.org> | 2012-04-14 13:54:10 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2012-04-14 13:54:10 +0000 |
commit | 1fc08f5e9ef733ef1ce6f363fecedc2260e78974 (patch) | |
tree | 19c69a04768629f2d440944b71cbe90adae0b615 /unittests/ExecutionEngine/JIT/MultiJITTest.cpp | |
parent | 07637c87f826cdf411f0673595e9bc92ebd793f2 (diff) | |
download | FreeBSD-src-1fc08f5e9ef733ef1ce6f363fecedc2260e78974.zip FreeBSD-src-1fc08f5e9ef733ef1ce6f363fecedc2260e78974.tar.gz |
Vendor import of llvm trunk r154661:
http://llvm.org/svn/llvm-project/llvm/trunk@r154661
Diffstat (limited to 'unittests/ExecutionEngine/JIT/MultiJITTest.cpp')
-rw-r--r-- | unittests/ExecutionEngine/JIT/MultiJITTest.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/unittests/ExecutionEngine/JIT/MultiJITTest.cpp b/unittests/ExecutionEngine/JIT/MultiJITTest.cpp index 91ea64a..5b99d5b 100644 --- a/unittests/ExecutionEngine/JIT/MultiJITTest.cpp +++ b/unittests/ExecutionEngine/JIT/MultiJITTest.cpp @@ -26,7 +26,7 @@ bool LoadAssemblyInto(Module *M, const char *assembly) { NULL != ParseAssemblyString(assembly, M, Error, M->getContext()); std::string errMsg; raw_string_ostream os(errMsg); - Error.Print("", os); + Error.print("", os); EXPECT_TRUE(success) << os.str(); return success; } @@ -160,8 +160,21 @@ TEST(MultiJitTest, JitPool) { EXPECT_EQ(getPointerToNamedFunction("foo2"), foo2); // Symbol search - EXPECT_EQ((intptr_t)getPointerToNamedFunction("getPointerToNamedFunction"), - (intptr_t)&getPointerToNamedFunction); + intptr_t + sa = (intptr_t)getPointerToNamedFunction("getPointerToNamedFunction"); + EXPECT_TRUE(sa != 0); + intptr_t fa = (intptr_t)&getPointerToNamedFunction; + EXPECT_TRUE(fa != 0); +#ifdef __i386__ + // getPointerToNamedFunction might be indirect jump on Win32 --enable-shared. + // FF 25 <disp32>: jmp *(pointer to IAT) + if (sa != fa && memcmp((char *)fa, "\xFF\x25", 2) == 0) { + fa = *(intptr_t *)(fa + 2); // Address to IAT + EXPECT_TRUE(fa != 0); + fa = *(intptr_t *)fa; // Bound value of IAT + } +#endif + EXPECT_TRUE(sa == fa); } #endif // !defined(__arm__) |