mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-12 17:32:19 +00:00
unittests/MultiJITTest.cpp: Tweak how to check symbol value for Win32 --enable-shared.
getPointerToNamedFunction might be indirect jump on Win32 --enable-shared. FF 25 <disp32>: jmp *(pointer to IAT) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144178 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0a15035f52
commit
94d80da4a0
@ -160,8 +160,21 @@ TEST(MultiJitTest, JitPool) {
|
|||||||
EXPECT_EQ(getPointerToNamedFunction("foo2"), foo2);
|
EXPECT_EQ(getPointerToNamedFunction("foo2"), foo2);
|
||||||
|
|
||||||
// Symbol search
|
// Symbol search
|
||||||
EXPECT_EQ((intptr_t)getPointerToNamedFunction("getPointerToNamedFunction"),
|
intptr_t
|
||||||
(intptr_t)&getPointerToNamedFunction);
|
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__)
|
#endif // !defined(__arm__)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user