aboutsummaryrefslogtreecommitdiffstats
path: root/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp')
-rw-r--r--unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp b/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp
index c80b88b..f2a3000 100644
--- a/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp
+++ b/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp
@@ -347,6 +347,38 @@ TEST_F(MCJITCAPITest, simple_function) {
EXPECT_EQ(42, functionPointer.usable());
}
+TEST_F(MCJITCAPITest, gva) {
+ SKIP_UNSUPPORTED_PLATFORM;
+
+ Module = LLVMModuleCreateWithName("simple_module");
+ LLVMSetTarget(Module, HostTriple.c_str());
+ LLVMValueRef GlobalVar = LLVMAddGlobal(Module, LLVMInt32Type(), "simple_value");
+ LLVMSetInitializer(GlobalVar, LLVMConstInt(LLVMInt32Type(), 42, 0));
+
+ buildMCJITOptions();
+ buildMCJITEngine();
+ buildAndRunPasses();
+
+ uint64_t raw = LLVMGetGlobalValueAddress(Engine, "simple_value");
+ int32_t *usable = (int32_t *) raw;
+
+ EXPECT_EQ(42, *usable);
+}
+
+TEST_F(MCJITCAPITest, gfa) {
+ SKIP_UNSUPPORTED_PLATFORM;
+
+ buildSimpleFunction();
+ buildMCJITOptions();
+ buildMCJITEngine();
+ buildAndRunPasses();
+
+ uint64_t raw = LLVMGetFunctionAddress(Engine, "simple_function");
+ int (*usable)() = (int (*)()) raw;
+
+ EXPECT_EQ(42, usable());
+}
+
TEST_F(MCJITCAPITest, custom_memory_manager) {
SKIP_UNSUPPORTED_PLATFORM;