[ELF] Make section member orders consistent
[llvm-project.git] / lld / test / ELF / riscv-relax-hi20-lo12.s
blob6bb29b12348f805fd9638b4d62a583983111220b
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
7 # RUN: ld.lld --relax-gp --undefined=__global_pointer$ rv32.o lds -o rv32
8 # RUN: ld.lld --relax-gp --undefined=__global_pointer$ rv64.o lds -o rv64
9 # RUN: llvm-objdump -td -M no-aliases --no-show-raw-insn rv32 | FileCheck %s
10 # RUN: llvm-objdump -td -M no-aliases --no-show-raw-insn rv64 | FileCheck %s
12 # CHECK: 00000028 l .text {{0*}}0 a
14 # CHECK-NOT: lui
15 # CHECK: addi a0, gp, -0x800
16 # CHECK-NEXT: lw a0, -0x800(gp)
17 # CHECK-NEXT: sw a0, -0x800(gp)
18 # CHECK-NOT: lui
19 # CHECK-NEXT: addi a0, gp, 0x7ff
20 # CHECK-NEXT: lb a0, 0x7ff(gp)
21 # CHECK-NEXT: sb a0, 0x7ff(gp)
22 # CHECK-NEXT: lui a0, 0x201
23 # CHECK-NEXT: addi a0, a0, 0x0
24 # CHECK-NEXT: lw a0, 0x0(a0)
25 # CHECK-NEXT: sw a0, 0x0(a0)
26 # CHECK-EMPTY:
27 # CHECK-NEXT: <a>:
28 # CHECK-NEXT: addi a0, a0, 0x1
30 #--- a.s
31 .global _start
32 _start:
33 lui a0, %hi(foo)
34 addi a0, a0, %lo(foo)
35 lw a0, %lo(foo)(a0)
36 sw a0, %lo(foo)(a0)
37 lui a0, %hi(bar)
38 addi a0, a0, %lo(bar)
39 lb a0, %lo(bar)(a0)
40 sb a0, %lo(bar)(a0)
41 lui a0, %hi(norelax)
42 addi a0, a0, %lo(norelax)
43 lw a0, %lo(norelax)(a0)
44 sw a0, %lo(norelax)(a0)
46 addi a0, a0, 1
48 .section .sdata,"aw"
49 foo:
50 .word 0
51 .space 4091
52 bar:
53 .byte 0
54 norelax:
55 .word 0
57 #--- lds
58 SECTIONS {
59 .text : {*(.text) }
60 .sdata 0x200000 : { }