diff options
author | NAKAMURA Takumi <geek4civic@gmail.com> | 2014-03-11 00:34:38 +0000 |
---|---|---|
committer | NAKAMURA Takumi <geek4civic@gmail.com> | 2014-03-11 00:34:38 +0000 |
commit | 8800becdd1afc79911b344de76b5d3b9ba823374 (patch) | |
tree | dd8c6fa4bb372c3b4f166e5066842f1f8ef8c475 /llvm/unittests/ExecutionEngine/JIT/MultiJITTest.cpp | |
parent | 2f1f1818bf146baf570ca0e1e566440849b85dd1 (diff) | |
download | bcm5719-llvm-8800becdd1afc79911b344de76b5d3b9ba823374.tar.gz bcm5719-llvm-8800becdd1afc79911b344de76b5d3b9ba823374.zip |
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.
llvm-svn: 203523
Diffstat (limited to 'llvm/unittests/ExecutionEngine/JIT/MultiJITTest.cpp')
-rw-r--r-- | llvm/unittests/ExecutionEngine/JIT/MultiJITTest.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/unittests/ExecutionEngine/JIT/MultiJITTest.cpp b/llvm/unittests/ExecutionEngine/JIT/MultiJITTest.cpp index 48aa9557699..5016532eef8 100644 --- a/llvm/unittests/ExecutionEngine/JIT/MultiJITTest.cpp +++ b/llvm/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); } |