• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# REQUIRES: x86
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
5
6# CHECK:      Contents of section .got:
7# CHECK-NEXT: {{^}} [[#%x,ADDR:]] {{.*}} 00000000
8
9# CHECK:      leal {{.*}}(%rip), %eax  # {{.*}} <foo>
10# CHECK-NEXT: movl {{.*}}(%rip), %eax  # [[#ADDR+4]]
11# CHECK-NEXT: movq {{.*}}(%rip), %rax  # [[#ADDR+1]]
12
13## movl foo@GOTPCREL(%rip), %eax
14  movl 0(%rip), %eax
15  .reloc .-4, R_X86_64_GOTPCRELX, foo-4
16
17## The instruction has an offset (addend!=-4). It is incorrect to relax movl to leal.
18## movl foo@GOTPCREL+4(%rip), %eax
19  movl 0(%rip), %eax
20  .reloc .-4, R_X86_64_GOTPCRELX, foo
21
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
25  movq 0(%rip), %rax
26  .reloc .-4, R_X86_64_REX_GOTPCRELX, foo-3
27
28.globl foo
29foo:
30  nop
31