[ELF] Make SyntheticSection parameter order match InputSection
[llvm-project.git] / lld / test / ELF / x86-64-gotpc-offset.s
blob2e6ace5ea87f4b7f877c71d77bf9927f6f597009
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
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
14 movl 0(%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
19 movl 0(%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
25 movq 0(%rip), %rax
26 .reloc .-4, R_X86_64_REX_GOTPCRELX, foo-3
28 .globl foo
29 foo:
30 nop