2 # RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
3 # RUN: ld.lld %t.o -o %t
4 # RUN: llvm-objdump -s -d %t | FileCheck %s
6 # CHECK: Contents of section .got:
7 # CHECK-NEXT: {{^}} [[#%x,ADDR:]] {{.*}} 00000000
9 # CHECK: leal {{.*}}(%rip), %eax # {{.*}} <foo>
10 # CHECK-NEXT: movl {{.*}}(%rip), %eax # 0x[[#ADDR+4]]
11 # CHECK-NEXT: movq {{.*}}(%rip), %rax # 0x[[#ADDR+1]]
13 ## movl foo@GOTPCREL(%rip), %eax
15 .reloc .-4, R_X86_64_GOTPCRELX, foo-4
17 ## The instruction has an offset (addend!=-4). It is incorrect to relax movl to leal.
18 ## movl foo@GOTPCREL+4(%rip), %eax
20 .reloc .-4, R_X86_64_GOTPCRELX, foo
22 ## This does not make sense because it loads one byte past the GOT entry.
23 ## It is just to demonstrate the behavior.
24 ## movq foo@GOTPCREL+1(%rip), %rax
26 .reloc .-4, R_X86_64_REX_GOTPCRELX, foo-3