Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / ELF / riscv-relax-hi20-lo12-pie.s
blob87e4f8f000e599d092e02695bd327e202e47b11f
1 # REQUIRES: riscv
2 # RUN: rm -rf %t && split-file %s %t && cd %t
4 # RUN: llvm-mc -filetype=obj -triple=riscv32-unknown-elf -mattr=+relax a.s -o rv32.o
5 # RUN: llvm-mc -filetype=obj -triple=riscv64-unknown-elf -mattr=+relax a.s -o rv64.o
6 # RUN: llvm-mc -filetype=obj -triple=riscv64-unknown-elf -mattr=+relax a.s -o rv64-pie.o
8 # RUN: ld.lld --relax-gp --undefined=__global_pointer$ rv32.o lds -pie -o rv32
9 # RUN: ld.lld --relax-gp --undefined=__global_pointer$ rv64.o lds -shared -o rv64
10 # RUN: llvm-objdump -td -M no-aliases --no-show-raw-insn rv32 | FileCheck %s
11 # RUN: llvm-objdump -td -M no-aliases --no-show-raw-insn rv64 | FileCheck %s
13 # CHECK: lui a0, 512
14 # CHECK-NEXT: addi a0, a0, 1
15 # CHECK-NEXT: lw a0, 1(a0)
16 # CHECK-NEXT: sw a0, 1(a0)
18 #--- a.s
19 .globl abs
20 abs = 0x200001
22 .global _start
23 _start:
24 lui a0, %hi(abs)
25 addi a0, a0, %lo(abs)
26 lw a0, %lo(abs)(a0)
27 sw a0, %lo(abs)(a0)
29 #--- lds
30 SECTIONS {
31 .text : {*(.text) }
32 .sdata 0x200000 : {}