1# RUN: not llvm-mc -filetype=obj -triple=riscv32 -mattr=+relax %s 2>&1 \ 2# RUN: | FileCheck %s -check-prefix=CHECK-RELAX 3# RUN: llvm-mc -filetype=obj -triple=riscv32 -mattr=-relax %s 2>&1 \ 4# RUN: | llvm-objdump -d - | FileCheck %s -check-prefix=CHECK-INSTR 5# RUN: llvm-mc -filetype=obj -triple=riscv32 -mattr=-relax %s 2>&1 \ 6# RUN: | llvm-objdump -r - | FileCheck %s -check-prefix=CHECK-REL 7 8# Check the assembler rejects hi and lo expressions with constant expressions 9# involving labels when diff expressions are emitted as relocation pairs. 10# Test case derived from test/MC/Mips/hilo-addressing.s 11 12tmp1: 13 # Emit zeros so that difference between tmp1 and tmp3 is 0x30124 bytes. 14 .fill 0x30124-8 15tmp2: 16# CHECK-RELAX: :[[@LINE+1]]:{{[0-9]+}}: error: expected relocatable expression 17 lui t0, %hi(tmp3-tmp1) 18# CHECK-RELAX: :[[@LINE+1]]:{{[0-9]+}}: error: expected relocatable expression 19 lw ra, %lo(tmp3-tmp1)(t0) 20# CHECK-INSTR: lui t0, 48 21# CHECK-INSTR: lw ra, 292(t0) 22 23tmp3: 24# CHECK-RELAX: :[[@LINE+1]]:{{[0-9]+}}: error: expected relocatable expression 25 lui t1, %hi(tmp2-tmp3) 26# CHECK-RELAX: :[[@LINE+1]]:{{[0-9]+}}: error: expected relocatable expression 27 lw sp, %lo(tmp2-tmp3)(t1) 28# CHECK-INSTR: lui t1, 0 29# CHECK-INSTR: lw sp, -8(t1) 30 31# CHECK-REL-NOT: R_RISCV