2 ## The x86-64 psABI uses Elf64_Rela relocation entries. We produce
3 ## Elf64_Rel dynamic relocations by default, but can use Elf64_Rel with -z rel.
5 # RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
6 # RUN: ld.lld -shared %t.o -o %t.so
7 # RUN: llvm-readobj -d -r %t.so | FileCheck --check-prefix=RELA %s
8 # RUN: ld.lld -shared -z rela %t.o -o %t1.so
9 # RUN: llvm-readobj -d -r %t1.so | FileCheck --check-prefix=RELA %s
12 # RELA-NEXT: RELASZ 72 (bytes)
13 # RELA-NEXT: RELAENT 24 (bytes)
14 # RELA-NEXT: RELACOUNT 1
15 # RELA-NEXT: JMPREL {{.*}}
16 # RELA-NEXT: PLTRELSZ 24 (bytes)
17 # RELA-NEXT: PLTGOT {{.*}}
18 # RELA-NEXT: PLTREL RELA
20 # RELA-NEXT: R_X86_64_RELATIVE - 0x3428
21 # RELA-NEXT: R_X86_64_GLOB_DAT func 0x0
22 # RELA-NEXT: R_X86_64_64 _start 0x2A
24 # RELA-NEXT: .rela.plt {
25 # RELA-NEXT: R_X86_64_JUMP_SLOT func 0x0
28 # RUN: ld.lld -shared -z rela -z rel %t.o -o %t2.so --fatal-warnings
29 # RUN: llvm-readobj -d -r -x .data %t2.so | FileCheck --check-prefix=REL %s
32 # REL-NEXT: RELSZ 48 (bytes)
33 # REL-NEXT: RELENT 16 (bytes)
34 # REL-NEXT: RELCOUNT 1
35 # REL-NEXT: JMPREL {{.*}}
36 # REL-NEXT: PLTRELSZ 16 (bytes)
37 # REL-NEXT: PLTGOT {{.*}}
38 # REL-NEXT: PLTREL REL{{$}}
40 # REL-NEXT: R_X86_64_RELATIVE
41 # REL-NEXT: R_X86_64_GLOB_DAT func
42 # REL-NEXT: R_X86_64_64 _start
44 # REL-NEXT: .rel.plt {
45 # REL-NEXT: R_X86_64_JUMP_SLOT func
48 # REL: Hex dump of section '.data':
49 # REL-NEXT: 0x00003408 08340000 00000000 2a000000 00000000
54 movq func@GOTPCREL
(%rip
), %rax