MultiJITTest.cpp: Tweak getPointerToNamedFunction() to be aware of also Windows x64.

In import thunk, jmp is:
  - On x86, 0xFF 0x25 [disp32].
  - On x64, 0xFF 0x25 [pcrel32].

See also my r144178.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203523 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
NAKAMURA Takumi 2014-03-11 00:34:38 +00:00
parent fc77954998
commit 2ab1641041

View File

@ -174,6 +174,14 @@ TEST(MultiJitTest, JitPool) {
EXPECT_TRUE(fa != 0);
fa = *(intptr_t *)fa; // Bound value of IAT
}
#elif defined(__x86_64__)
// getPointerToNamedFunction might be indirect jump
// on Win32 x64 --enable-shared.
// FF 25 <pcrel32>: jmp *(RIP + pointer to IAT)
if (sa != fa && memcmp((char *)fa, "\xFF\x25", 2) == 0) {
fa += *(int32_t *)(fa + 2) + 6; // Address to IAT(RIP)
fa = *(intptr_t *)fa; // Bound value of IAT
}
#endif
EXPECT_TRUE(sa == fa);
}