Skip to content

Commit 6e4e88d

Browse files
committed
[test] Improve R_RISCV_PLT32 and R_RISCV_GOT32_PCREL tests
1 parent adcaf17 commit 6e4e88d

File tree

3 files changed

+43
-30
lines changed

3 files changed

+43
-30
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# RUN: llvm-mc -triple=riscv64 -filetype=obj %s | llvm-readobj -r - | FileCheck %s --check-prefixes=CHECK,RV64
2+
# RUN: llvm-mc -triple=riscv32 -filetype=obj %s | llvm-readobj -r - | FileCheck %s --check-prefixes=CHECK,RV32
3+
4+
# RUN: not llvm-mc -triple=riscv64 -filetype=obj %s --defsym ERR=1 -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR --implicit-check-not=error:
5+
6+
.globl g
7+
g:
8+
l:
9+
10+
# CHECK: Section ({{.*}}) .rela.data {
11+
# CHECK-NEXT: 0x0 R_RISCV_PLT32 l 0x0
12+
# CHECK-NEXT: 0x4 R_RISCV_PLT32 l 0x4
13+
# CHECK-NEXT: 0x8 R_RISCV_PLT32 extern 0x4
14+
# CHECK-NEXT: 0xC R_RISCV_PLT32 g 0x8
15+
# CHECK-NEXT: 0x10 R_RISCV_PLT32 g 0x18
16+
# CHECK-NEXT: }
17+
.data
18+
.word l@plt - .
19+
.word l@plt - .data
20+
21+
.word extern@plt - . + 4
22+
.word g@plt - . + 8
23+
.word g@plt - .data + 8
24+
25+
# CHECK: Section ({{.*}}) .rela.data1 {
26+
# CHECK-NEXT: 0x0 R_RISCV_GOT32_PCREL data1 0x0
27+
# CHECK-NEXT: 0x4 R_RISCV_GOT32_PCREL extern 0x4
28+
# RV32-NEXT: 0x8 R_RISCV_GOT32_PCREL extern 0xFFFFFFFB
29+
# RV64-NEXT: 0x8 R_RISCV_GOT32_PCREL extern 0xFFFFFFFFFFFFFFFB
30+
# CHECK-NEXT: }
31+
.section .data1,"aw"
32+
data1:
33+
.word data1@GOTPCREL
34+
.word extern@gotpcrel+4
35+
.word extern@GOTPCREL-5
36+
37+
.ifdef ERR
38+
# ERR: [[#@LINE+1]]:7: error: symbol 'und' can not be undefined in a subtraction expression
39+
.word extern@plt - und
40+
41+
# ERR: [[#@LINE+1]]:7: error: symbol 'und' can not be undefined in a subtraction expression
42+
.word extern@gotpcrel - und
43+
.endif

llvm/test/MC/RISCV/elf-reloc-got32-pcrel.s

Lines changed: 0 additions & 14 deletions
This file was deleted.

llvm/test/MC/RISCV/elf-reloc-plt32.s

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)