1# REQUIRES: x86 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. 4 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 10 11# RELA: RELA {{.*}} 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 19# RELA: .rela.dyn { 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 23# RELA-NEXT: } 24# RELA-NEXT: .rela.plt { 25# RELA-NEXT: R_X86_64_JUMP_SLOT func 0x0 26# RELA-NEXT: } 27 28# RUN: ld.lld -shared -z rela -z rel %t.o -o %t2.so 29# RUN: llvm-readobj -d -r -x .data %t2.so | FileCheck --check-prefix=REL %s 30 31# REL: REL {{.*}} 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{{$}} 39# REL: .rel.dyn { 40# REL-NEXT: R_X86_64_RELATIVE 41# REL-NEXT: R_X86_64_GLOB_DAT func 42# REL-NEXT: R_X86_64_64 _start 43# REL-NEXT: } 44# REL-NEXT: .rel.plt { 45# REL-NEXT: R_X86_64_JUMP_SLOT func 46# REL-NEXT: } 47 48# REL: Hex dump of section '.data': 49# REL-NEXT: 0x00003408 08340000 00000000 2a000000 00000000 50 51.globl _start 52_start: 53 call func@PLT 54 movq func@GOTPCREL(%rip), %rax 55 56.data 57 .quad .data 58 .quad _start+42 59