summaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorNAKAMURA Takumi <geek4civic@gmail.com>2014-03-11 00:34:38 +0000
committerNAKAMURA Takumi <geek4civic@gmail.com>2014-03-11 00:34:38 +0000
commit2ab1641041a6a96af5578d89e4d7f8c932cad381 (patch)
treefaf4ab146d0711cb32379f46c6490b14e34cc7e7 /unittests
parentfc779549980436807fb9ed721c893813cbd5e621 (diff)
downloadllvm-2ab1641041a6a96af5578d89e4d7f8c932cad381.tar.gz
llvm-2ab1641041a6a96af5578d89e4d7f8c932cad381.tar.bz2
llvm-2ab1641041a6a96af5578d89e4d7f8c932cad381.tar.xz
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
Diffstat (limited to 'unittests')
-rw-r--r--unittests/ExecutionEngine/JIT/MultiJITTest.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/unittests/ExecutionEngine/JIT/MultiJITTest.cpp b/unittests/ExecutionEngine/JIT/MultiJITTest.cpp
index 48aa955769..5016532eef 100644
--- a/unittests/ExecutionEngine/JIT/MultiJITTest.cpp
+++ b/unittests/ExecutionEngine/JIT/MultiJITTest.cpp
@@ -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);
}