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