xref: /llvm-project/llvm/test/ExecutionEngine/MCJIT/2013-04-04-RelocAddend.ll (revision 2d56d8c4e8751c7e2cab927cdeb4e519af3f3585)
1; RUN: %lli -jit-kind=mcjit %s
2; RUN: %lli %s
3;
4; Verify relocations to global symbols with addend work correctly.
5;
6; Compiled from this C code:
7;
8; int test[2] = { -1, 0 };
9; int *p = &test[1];
10;
11; int main (void)
12; {
13;   return *p;
14; }
15;
16
17@test = global [2 x i32] [i32 -1, i32 0], align 4
18@p = global ptr getelementptr inbounds ([2 x i32], ptr @test, i64 0, i64 1), align 8
19
20define i32 @main() {
21entry:
22  %0 = load ptr, ptr @p, align 8
23  %1 = load i32, ptr %0, align 4
24  ret i32 %1
25}
26
27