51 lines · plain
1# REQUIRES: riscv2## The regression test led to oscillation between two states ("address assignment did not converge" error).3## First jump (~2^11 bytes away): alternated between 4 and 8 bytes.4## Second jump (~2^20 bytes away): alternated between 2 and 8 bytes.5 6# RUN: rm -rf %t && split-file %s %t && cd %t7# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+c,+relax a.s -o a.o8# RUN: ld.lld -T lds a.o -o out9# RUN: llvm-objdump -td --no-show-raw-insn -M no-aliases out | FileCheck %s10 11# CHECK-LABEL: <_start>:12# CHECK-NEXT: jal zero, {{.*}} <low>13# CHECK-EMPTY:14# CHECK-NEXT: <jump_high>:15# CHECK-NEXT: 1004: auipc t0, 0x10016# CHECK-NEXT: jalr zero, -0x2(t0) <high>17# CHECK-NEXT: ...18# CHECK: <low>:19# CHECK: 1802: c.jr ra20 21# CHECK: <high>:22# CHECK-NEXT: 101002: jal ra, 0x1004 <jump_high>23# CHECK-NEXT: auipc ra, 0xfff0024# CHECK-NEXT: jalr ra, -0x2(ra) <jump_high>25 26#--- a.s27## At the beginning of state1, low-_start = 0x800-2, reachable by a c.j.28## This increases high-jump_high from 0x100000-2 to 0x100000, unreachable by a jal.29## In the next iteration, low-_start increases to 0x800, unreachable by a c.j.30.global _start31_start:32 jump low, t0 # state0: 4 bytes; state1: 2 bytes33jump_high:34 jump high, t0 # state0: 4 bytes; state1: 8 bytes35 36 .space 0x800-1037low:38 ret39 40.section .high,"ax",@progbits41 nop42high:43 call jump_high44 call jump_high45 46#--- lds47SECTIONS {48 .text 0x1000 : { *(.text) }49 .high 0x101000 : { *(.high) }50}51