71 lines · plain
1# REQUIRES: riscv2# RUN: llvm-mc -filetype=obj -triple=riscv32 %s -o %t.32.o3# RUN: ld.lld -pie %t.32.o -o %t.324# RUN: ld.lld -pie %t.32.o -o %t.32-apply --apply-dynamic-relocs5# RUN: llvm-readobj -r -x .got.plt %t.32 | FileCheck --check-prefixes=RELOC32,NO-APPLY-RELOC32 %s6# RUN: llvm-readobj -r -x .got.plt %t.32-apply | FileCheck --check-prefixes=RELOC32,APPLY-RELOC32 %s7# RUN: llvm-readelf -s %t.32 | FileCheck --check-prefix=SYM32 %s8# RUN: llvm-objdump -d --no-show-raw-insn %t.32 | FileCheck --check-prefix=DIS32 %s9 10# RUN: llvm-mc -filetype=obj -triple=riscv64 %s -o %t.64.o11# RUN: ld.lld -pie %t.64.o -o %t.6412# RUN: ld.lld -pie %t.64.o -o %t.64-apply --apply-dynamic-relocs13# RUN: llvm-readobj -r -x .got.plt %t.64 | FileCheck --check-prefixes=RELOC64,NO-APPLY-RELOC64 %s14# RUN: llvm-readobj -r -x .got.plt %t.64-apply | FileCheck --check-prefixes=RELOC64,APPLY-RELOC64 %s15# RUN: llvm-readelf -s %t.64 | FileCheck --check-prefix=SYM64 %s16# RUN: llvm-objdump -d --no-show-raw-insn %t.64 | FileCheck --check-prefix=DIS64 %s17 18# RELOC32: .rela.dyn {19# RELOC32-NEXT: 0x3200 R_RISCV_IRELATIVE - 0x117C20# RELOC32-NEXT: }21# RELOC32-LABEL: Hex dump of section '.got.plt':22# NO-APPLY-RELOC32: 0x00003200 0000000023# APPLY-RELOC32: 0x00003200 7c11000024# RELOC32-EMPTY:25 26# SYM32: 0001190 0 FUNC GLOBAL DEFAULT {{.*}} func27 28# DIS32: <_start>:29# DIS32-NEXT: 1180: auipc a0, 0x030# DIS32-NEXT: addi a0, a0, 0x1031# DIS32: Disassembly of section .iplt:32# DIS32: <func>:33## 32-bit: &.got.plt[func]-. = 0x3200-0x1190 = 4096*2+0x7034# DIS32-NEXT: 1190: auipc t3, 0x235# DIS32-NEXT: lw t3, 0x70(t3)36# DIS32-NEXT: jalr t1, t337# DIS32-NEXT: nop38 39# RELOC64: .rela.dyn {40# RELOC64-NEXT: 0x3340 R_RISCV_IRELATIVE - 0x126041# RELOC64-NEXT: }42# RELOC64-LABEL: Hex dump of section '.got.plt':43# NO-APPLY-RELOC64: 0x00003340 00000000 0000000044# APPLY-RELOC64: 0x00003340 60120000 0000000045# RELOC64-EMPTY:46 47# SYM64: 000000000001270 0 FUNC GLOBAL DEFAULT {{.*}} func48 49# DIS64: <_start>:50# DIS64-NEXT: 1264: auipc a0, 0x051# DIS64-NEXT: addi a0, a0, 0xc52# DIS64: Disassembly of section .iplt:53# DIS64: <func>:54## 64-bit: &.got.plt[func]-. = 0x3340-0x1270 = 4096*2+0xd055# DIS64-NEXT: 1270: auipc t3, 0x256# DIS64-NEXT: ld t3, 0xd0(t3)57# DIS64-NEXT: jalr t1, t358# DIS64-NEXT: nop59 60.text61.globl func62.type func, @gnu_indirect_function63func:64 ret65 66.globl _start67_start:68.L:69 auipc a0, %pcrel_hi(func)70 addi a0, a0, %pcrel_lo(.L)71