X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=unittests%2FExecutionEngine%2FJIT%2FMultiJITTest.cpp;h=b3e992639db652c3b120a80a58005da0711a4a1e;hb=1218bc4fe627ae4d60491ea89124965302815f1f;hp=c0c1f262421ae579299cb992d7ff8d38c86e2874;hpb=d8b7aa26134d2abee777f745c32005e63dea2455;p=oota-llvm.git diff --git a/unittests/ExecutionEngine/JIT/MultiJITTest.cpp b/unittests/ExecutionEngine/JIT/MultiJITTest.cpp index c0c1f262421..b3e992639db 100644 --- a/unittests/ExecutionEngine/JIT/MultiJITTest.cpp +++ b/unittests/ExecutionEngine/JIT/MultiJITTest.cpp @@ -7,19 +7,22 @@ // //===----------------------------------------------------------------------===// -#include "gtest/gtest.h" -#include "llvm/LLVMContext.h" -#include "llvm/Module.h" +#include "llvm/ExecutionEngine/JIT.h" #include "llvm/Assembly/Parser.h" #include "llvm/ExecutionEngine/GenericValue.h" -#include "llvm/ExecutionEngine/JIT.h" +#include "llvm/IR/LLVMContext.h" +#include "llvm/IR/Module.h" #include "llvm/Support/SourceMgr.h" +#include "gtest/gtest.h" #include using namespace llvm; namespace { +// ARM and PowerPC tests disabled pending fix for PR10783. +#if !defined(__arm__) && !defined(__powerpc__) + bool LoadAssemblyInto(Module *M, const char *assembly) { SMDiagnostic Error; bool success = @@ -65,9 +68,6 @@ void createModule2(LLVMContext &Context2, Module *&M2, Function *&FooF2) { FooF2 = M2->getFunction("foo2"); } -// ARM tests disabled pending fix for PR10783. -#if !defined(__arm__) - TEST(MultiJitTest, EagerMode) { LLVMContext Context1; Module *M1 = 0; @@ -160,9 +160,22 @@ TEST(MultiJitTest, JitPool) { EXPECT_EQ(getPointerToNamedFunction("foo2"), foo2); // Symbol search - EXPECT_EQ((intptr_t)getPointerToNamedFunction("getPointerToNamedFunction"), - (intptr_t)&getPointerToNamedFunction); + intptr_t + 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 : 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__) && !defined(__powerpc__) } // anonymous namespace