31 lines · plain
1# REQUIRES: x862# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o3# RUN: ld.lld %t.o -o %t4# RUN: llvm-objdump -s -d %t | FileCheck %s5 6# CHECK: Contents of section .got:7# CHECK-NEXT: {{^}} [[#%x,ADDR:]] {{.*}} 000000008 9# CHECK: leal {{.*}}(%rip), %eax # {{.*}} <foo>10# CHECK-NEXT: movl {{.*}}(%rip), %eax # 0x[[#ADDR+4]]11# CHECK-NEXT: movq {{.*}}(%rip), %rax # 0x[[#ADDR+1]]12 13## movl foo@GOTPCREL(%rip), %eax14 movl 0(%rip), %eax15 .reloc .-4, R_X86_64_GOTPCRELX, foo-416 17## The instruction has an offset (addend!=-4). It is incorrect to relax movl to leal.18## movl foo@GOTPCREL+4(%rip), %eax19 movl 0(%rip), %eax20 .reloc .-4, R_X86_64_GOTPCRELX, foo21 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), %rax25 movq 0(%rip), %rax26 .reloc .-4, R_X86_64_REX_GOTPCRELX, foo-327 28.globl foo29foo:30 nop31