1# RUN: rm -rf %t && mkdir -p %t
2# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj -o %t/test_ELF1_x86-64.o %s
3# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj -o %t/test_ELF2_x86-64.o %s
4# RUN: llc -mtriple=x86_64-pc-linux -filetype=obj -o %t/test_ELF_ExternalGlobal_x86-64.o %S/Inputs/ExternalGlobal.ll
5# RUN: llvm-rtdyld -triple=x86_64-pc-linux -verify %t/test_ELF1_x86-64.o  %t/test_ELF_ExternalGlobal_x86-64.o
6# Test that we can load this code twice at memory locations more than 2GB apart
7# RUN: llvm-rtdyld -triple=x86_64-pc-linux -verify -map-section test_ELF1_x86-64.o,.got=0x10000 -map-section test_ELF2_x86-64.o,.text=0x100000000 -map-section test_ELF2_x86-64.o,.got=0x100010000 %t/test_ELF1_x86-64.o %t/test_ELF2_x86-64.o %t/test_ELF_ExternalGlobal_x86-64.o
8
9# Assembly obtained by compiling the following and adding checks:
10# @G = external global i8*
11#
12# define i8* @foo() {
13#    %ret = load i8** @G
14#    ret i32 %ret
15# }
16#
17
18#
19	.text
20	.file	"ELF_x64-64_PIC_relocations.ll"
21	.align	16, 0x90
22	.type	foo,@function
23foo:                                    # @foo
24# %bb.0:
25	movq	G@GOTPCREL(%rip), %rax
26	movl	(%rax), %eax
27	retq
28.Ltmp0:
29	.size	foo, .Ltmp0-foo
30
31
32	.section	".note.GNU-stack","",@progbits
33