1; RUN: llc < %s -relocation-model=pic -mtriple=x86_64-pc-linux | FileCheck %s 2; RUN: llc < %s -relocation-model=pic -mtriple=i386-pc-linux | FileCheck --check-prefix=I386 %s 3 4@foo1 = extern_weak hidden global i32, align 4 5define i32* @bar1() { 6 ret i32* @foo1 7} 8; CHECK: bar1: 9; CHECK: movq foo1@GOTPCREL(%rip), %rax 10; I386: bar1: 11; I386: movl foo1@GOT(%eax), %eax 12 13@foo2 = external hidden global i32, align 4 14define i32* @bar2() { 15 ret i32* @foo2 16} 17; CHECK: bar2: 18; CHECK: leaq foo2(%rip), %rax 19; I386: bar2: 20; I386: leal foo2@GOTOFF(%eax), %eax 21 22declare extern_weak hidden void @foo3() 23define void @bar3() { 24 call void @foo3() 25 ret void 26} 27; CHECK: bar3: 28; CHECK: callq foo3 29; I386: bar3: 30; I386: calll foo3 31 32declare external hidden void @foo4() 33define void @bar4() { 34 call void @foo4() 35 ret void 36} 37; CHECK: bar4: 38; CHECK: callq foo4 39; I386: bar4: 40; I386: calll foo4 41 42declare extern_weak hidden i32 @foo5() 43define i32()* @bar5() { 44 ret i32()* @foo5 45} 46; CHECK: bar5: 47; CHECK: movq foo5@GOTPCREL(%rip), %rax 48; I386: bar5: 49; I386: movl foo5@GOT(%eax), %eax 50 51declare external hidden i32 @foo6() 52define i32()* @bar6() { 53 ret i32()* @foo6 54} 55; CHECK: bar6: 56; CHECK: leaq foo6(%rip), %rax 57; I386: bar6: 58; I386: leal foo6@GOTOFF(%eax), %eax 59