mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
Fix the C-API MCJIT test for 32-bit big endian machines.
Avoid using unions for storing the return value from LLVMGetGlobalValueAddress() and LLVMGetFunctionAddress() and accessing it as a pointer through another pointer member. This causes problems on 32-bit big endian machines since the pointer gets the higher part of the return value of the aforementioned functions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226170 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b6d562e480
commit
add8f51c26
@ -359,13 +359,10 @@ TEST_F(MCJITCAPITest, gva) {
|
||||
buildMCJITEngine();
|
||||
buildAndRunPasses();
|
||||
|
||||
union {
|
||||
uint64_t raw;
|
||||
int32_t *usable;
|
||||
} valuePointer;
|
||||
valuePointer.raw = LLVMGetGlobalValueAddress(Engine, "simple_value");
|
||||
uint64_t raw = LLVMGetGlobalValueAddress(Engine, "simple_value");
|
||||
int32_t *usable = (int32_t *) raw;
|
||||
|
||||
EXPECT_EQ(42, *valuePointer.usable);
|
||||
EXPECT_EQ(42, *usable);
|
||||
}
|
||||
|
||||
TEST_F(MCJITCAPITest, gfa) {
|
||||
@ -376,13 +373,10 @@ TEST_F(MCJITCAPITest, gfa) {
|
||||
buildMCJITEngine();
|
||||
buildAndRunPasses();
|
||||
|
||||
union {
|
||||
uint64_t raw;
|
||||
int (*usable)();
|
||||
} functionPointer;
|
||||
functionPointer.raw = LLVMGetFunctionAddress(Engine, "simple_function");
|
||||
uint64_t raw = LLVMGetFunctionAddress(Engine, "simple_function");
|
||||
int (*usable)() = (int (*)()) raw;
|
||||
|
||||
EXPECT_EQ(42, functionPointer.usable());
|
||||
EXPECT_EQ(42, usable());
|
||||
}
|
||||
|
||||
TEST_F(MCJITCAPITest, custom_memory_manager) {
|
||||
|
Loading…
Reference in New Issue
Block a user