59 lines · plain
1# REQUIRES: x862## The x86-64 psABI uses Elf64_Rela relocation entries. We produce3## 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.o6# RUN: ld.lld -shared %t.o -o %t.so7# RUN: llvm-readobj -d -r %t.so | FileCheck --check-prefix=RELA %s8# RUN: ld.lld -shared -z rela %t.o -o %t1.so9# RUN: llvm-readobj -d -r %t1.so | FileCheck --check-prefix=RELA %s10 11# RELA: RELA {{.*}}12# RELA-NEXT: RELASZ 72 (bytes)13# RELA-NEXT: RELAENT 24 (bytes)14# RELA-NEXT: RELACOUNT 115# RELA-NEXT: JMPREL {{.*}}16# RELA-NEXT: PLTRELSZ 24 (bytes)17# RELA-NEXT: PLTGOT {{.*}}18# RELA-NEXT: PLTREL RELA19# RELA: .rela.dyn {20# RELA-NEXT: R_X86_64_RELATIVE - 0x342821# RELA-NEXT: R_X86_64_GLOB_DAT func 0x022# RELA-NEXT: R_X86_64_64 _start 0x2A23# RELA-NEXT: }24# RELA-NEXT: .rela.plt {25# RELA-NEXT: R_X86_64_JUMP_SLOT func 0x026# RELA-NEXT: }27 28# RUN: ld.lld -shared -z rela -z rel %t.o -o %t2.so --fatal-warnings29# RUN: llvm-readobj -d -r -x .data %t2.so | FileCheck --check-prefix=REL %s30 31# REL: REL {{.*}}32# REL-NEXT: RELSZ 48 (bytes)33# REL-NEXT: RELENT 16 (bytes)34# REL-NEXT: RELCOUNT 135# 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_RELATIVE41# REL-NEXT: R_X86_64_GLOB_DAT func42# REL-NEXT: R_X86_64_64 _start43# REL-NEXT: }44# REL-NEXT: .rel.plt {45# REL-NEXT: R_X86_64_JUMP_SLOT func46# REL-NEXT: }47 48# REL: Hex dump of section '.data':49# REL-NEXT: 0x00003408 08340000 00000000 2a000000 0000000050 51.globl _start52_start:53 call func@PLT54 movq func@GOTPCREL(%rip), %rax55 56.data57 .quad .data58 .quad _start+4259