brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.5 KiB · 5f6babf Raw
198 lines · plain
1# REQUIRES: asserts2# RUN: llvm-mc -triple=riscv32 -mattr=+relax -filetype=obj -o %t.rv32 %s3# RUN: llvm-jitlink -num-threads=0 -debug-only=jitlink -noexec \4# RUN:     -slab-allocate 100Kb -slab-address 0x1000 -slab-page-size 4096 \5# RUN:     -check %s %t.rv32 2>&1 \6# RUN:     | FileCheck %s7 8# RUN: llvm-mc -triple=riscv64 -mattr=+relax -filetype=obj -o %t.rv64 %s9# RUN: llvm-jitlink -num-threads=0 -debug-only=jitlink -noexec \10# RUN:     -slab-allocate 100Kb -slab-address 0x1000 -slab-page-size 4096 \11# RUN:     -check %s %t.rv64 2>&1 \12# RUN:     | FileCheck %s13 14        .text15 16## Successful relaxation: call -> jal17        .globl  main18        .type   main,@function19main:20        call f21        .size   main, .-main22 23        .skip  (1 << 20) - (. - main) - 224 25        .globl f26        .type   f,@function27f:28        call main29        .size f, .-f30 31## Failed relaxation: call -> auipc, jalr32        .globl g33g:34        call h35        .size g, .-g36 37        .skip  (1 << 20) - (. - g) + 238 39        .globl h40        .type   h,@function41h:42        call g43        .size h, .-h44 45## Successful relaxation: jump -> jal (not c.j as RVC is disabled)46        .globl i47        .type   i,@function48i:49        jump j, t050        .size i, .-i51 52        .skip  (1 << 11) - (. - i) - 253 54        .globl j55        .type   j,@function56j:57        jump i, t158        .size j, .-j59 60## Successful relaxation: jump -> jal61        .globl k62        .type   k,@function63k:64        jump l, t265        .size k, .-k66 67        .skip  (1 << 20) - (. - k) - 268 69        .globl l70        .type   l,@function71l:72        jump k, t373        .size l, .-l74 75## Failed relaxation: jump -> auipc, jalr76        .globl m77        .type   m,@function78m:79        jump n, t280        .size m, .-m81 82        .skip  (1 << 20) - (. - m) + 283 84        .globl n85        .type   n,@function86n:87        jump m, t388        .size n, .-n89 90## Successful relaxation: call -> jal91        .globl o92        .type   o,@function93o:94        call p95        .size o, .-o96 97        .skip  (1 << 11) - (. - o) - 298 99        .globl p100        .type   p,@function101p:102        call o103        .size p, .-p104 105# CHECK: Link graph before copy-and-fixup:106# CHECK: section .text:107# CHECK:   block 0x1000108# CHECK:     symbols:109# CHECK:       {{.*}} (block + 0x00000000): size: 0x00000004, linkage: strong, scope: default, live  -   main110# CHECK:       {{.*}} (block + 0x000ffffa): size: 0x00000004, linkage: strong, scope: default, live  -   f111# CHECK:       {{.*}} (block + 0x000ffffe): size: 0x00000008, linkage: strong, scope: default, live  -   g112# CHECK:       {{.*}} (block + 0x00200000): size: 0x00000008, linkage: strong, scope: default, live  -   h113# CHECK:       {{.*}} (block + 0x00200008): size: 0x00000004, linkage: strong, scope: default, live  -   i114# CHECK:       {{.*}} (block + 0x00200802): size: 0x00000004, linkage: strong, scope: default, live  -   j115# CHECK:       {{.*}} (block + 0x00200806): size: 0x00000004, linkage: strong, scope: default, live  -   k116# CHECK:       {{.*}} (block + 0x00300800): size: 0x00000004, linkage: strong, scope: default, live  -   l117# CHECK:       {{.*}} (block + 0x00300804): size: 0x00000008, linkage: strong, scope: default, live  -   m118# CHECK:       {{.*}} (block + 0x00400806): size: 0x00000008, linkage: strong, scope: default, live  -   n119# CHECK:       {{.*}} (block + 0x0040080e): size: 0x00000004, linkage: strong, scope: default, live  -   o120# CHECK:       {{.*}} (block + 0x00401008): size: 0x00000004, linkage: strong, scope: default, live  -   p121# CHECK:     edges:122# CHECK:       {{.*}} (block + 0x00000000), addend = +0x00000000, kind = R_RISCV_JAL, target = f123# CHECK:       {{.*}} (block + 0x000ffffa), addend = +0x00000000, kind = R_RISCV_JAL, target = main124# CHECK:       {{.*}} (block + 0x000ffffe), addend = +0x00000000, kind = R_RISCV_CALL_PLT, target = h125# CHECK:       {{.*}} (block + 0x00200000), addend = +0x00000000, kind = R_RISCV_CALL_PLT, target = g126# CHECK:       {{.*}} (block + 0x00200008), addend = +0x00000000, kind = R_RISCV_JAL, target = j127# CHECK:       {{.*}} (block + 0x00200802), addend = +0x00000000, kind = R_RISCV_JAL, target = i128# CHECK:       {{.*}} (block + 0x00200806), addend = +0x00000000, kind = R_RISCV_JAL, target = l129# CHECK:       {{.*}} (block + 0x00300800), addend = +0x00000000, kind = R_RISCV_JAL, target = k130# CHECK:       {{.*}} (block + 0x00300804), addend = +0x00000000, kind = R_RISCV_CALL_PLT, target = n131# CHECK:       {{.*}} (block + 0x00400806), addend = +0x00000000, kind = R_RISCV_CALL_PLT, target = m132# CHECK:       {{.*}} (block + 0x0040080e), addend = +0x00000000, kind = R_RISCV_JAL, target = p133# CHECK:       {{.*}} (block + 0x00401008), addend = +0x00000000, kind = R_RISCV_JAL, target = o134 135## main: jal f136# jitlink-check: (*{4}(main))[11:0] = 0xef137# jitlink-check: decode_operand(main, 1) = (f - main)138 139## f: jal main140# jitlink-check: (*{4}(f))[11:0] = 0xef141# jitlink-check: decode_operand(f, 1) = (main - f)142 143## g:144## - auipc ra, %pcrel_hi(h)145# jitlink-check: (*{4}(g))[11:0] = 0x97146# jitlink-check: decode_operand(g, 1) = (h - g + 0x800)[31:12]147## - jalr ra, %pcrel_lo(g)148# jitlink-check: (*{4}(g+4))[19:0] = 0x80e7149# jitlink-check: decode_operand(g+4, 2)[11:0] = (h - g)[11:0]150 151## h:152## - auipc ra, %pcrel_hi(g)153# jitlink-check: (*{4}(h))[11:0] = 0x97154# jitlink-check: decode_operand(h, 1) = (g - h + 0x800)[31:12]155## - jalr ra, %pcrel_lo(h)156# jitlink-check: (*{4}(h+4))[19:0] = 0x80e7157# jitlink-check: decode_operand(h+4, 2)[11:0] = (g - h)[11:0]158 159## i: jal x0, j160# jitlink-check: (*{4}(i))[11:0] = 0x6f161# jitlink-check: decode_operand(i, 1)[11:0] = (j - i)[11:0]162 163## j: jal x0, i164# jitlink-check: (*{4}(j))[11:0] = 0x6f165# jitlink-check: decode_operand(j, 1)[11:0] = (i - j)[11:0]166 167## k: jal x0, l168# jitlink-check: (*{4}(k))[11:0] = 0x6f169# jitlink-check: decode_operand(k, 1) = (l - k)170 171## l: jal x0, k172# jitlink-check: (*{4}(l))[11:0] = 0x6f173# jitlink-check: decode_operand(l, 1) = (k - l)174 175## m:176## - auipc t2, %pcrel_hi(n)177# jitlink-check: (*{4}(m))[11:0] = 0x397178# jitlink-check: decode_operand(m, 1) = (n - m + 0x800)[31:12]179## - jalr t2, %pcrel_lo(m)180# jitlink-check: (*{4}(m+4))[19:0] = 0x38067181# jitlink-check: decode_operand(m+4, 2)[11:0] = (n - m)[11:0]182 183## n:184## - auipc t3, %pcrel_hi(m)185# jitlink-check: (*{4}(n))[11:0] = 0xe17186# jitlink-check: decode_operand(n, 1) = (m - n + 0x800)[31:12]187## - jalr t3, %pcrel_lo(n)188# jitlink-check: (*{4}(n+4))[19:0] = 0xe0067189# jitlink-check: decode_operand(n+4, 2)[11:0] = (m - n)[11:0]190 191## o: jal p192# jitlink-check: (*{4}(o))[11:0] = 0xef193# jitlink-check: decode_operand(o, 1) = (p - o)194 195## p: jal o196# jitlink-check: (*{4}(p))[11:0] = 0xef197# jitlink-check: decode_operand(p, 1) = (o - p)198