[llvm] r203523 - MultiJITTest.cpp: Tweak getPointerToNamedFunction() to be aware of also Windows x64.
NAKAMURA Takumi
geek4civic at gmail.com
Mon Mar 10 17:34:38 PDT 2014
Author: chapuni
Date: Mon Mar 10 19:34:38 2014
New Revision: 203523
URL: http://llvm.org/viewvc/llvm-project?rev=203523&view=rev
Log:
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.
Modified:
llvm/trunk/unittests/ExecutionEngine/JIT/MultiJITTest.cpp
Modified: llvm/trunk/unittests/ExecutionEngine/JIT/MultiJITTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/JIT/MultiJITTest.cpp?rev=203523&r1=203522&r2=203523&view=diff
==============================================================================
--- llvm/trunk/unittests/ExecutionEngine/JIT/MultiJITTest.cpp (original)
+++ llvm/trunk/unittests/ExecutionEngine/JIT/MultiJITTest.cpp Mon Mar 10 19:34:38 2014
@@ -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);
}
More information about the llvm-commits
mailing list