xref: /llvm-project/llvm/test/MC/ELF/RISCV/subsection.s (revision e6fed06335f4a05aac900380c975b2daf8cbb934)
1# RUN: not llvm-mc -filetype=obj -triple=riscv64 -mattr=-relax %s -o /dev/null 2>&1 | FileCheck %s --check-prefixes=ERR,NORELAX --implicit-check-not=error:
2# RUN: not llvm-mc -filetype=obj -triple=riscv64 -mattr=+relax %s -o /dev/null 2>&1 | FileCheck %s --check-prefixes=ERR,RELAX --implicit-check-not=error:
3
4a:
5  nop
6b:
7  call foo@plt
8c:
9  nop
10d:
11
12.data
13## Positive subsection numbers
14## With relaxation, report an error as c-b is not an assemble-time constant.
15# RELAX: :[[#@LINE+1]]:14: error: cannot evaluate subsection number
16.subsection c-b
17# RELAX: :[[#@LINE+1]]:14: error: cannot evaluate subsection number
18.subsection d-b
19# RELAX: :[[#@LINE+1]]:14: error: cannot evaluate subsection number
20.subsection c-a
21
22.subsection b-a
23.subsection d-c
24
25## Negative subsection numbers
26# NORELAX: :[[#@LINE+2]]:14: error: subsection number -8 is not within [0,2147483647]
27# RELAX:   :[[#@LINE+1]]:14: error: cannot evaluate subsection number
28.subsection b-c
29# NORELAX: :[[#@LINE+2]]:14: error: subsection number -12 is not within [0,2147483647]
30# RELAX:   :[[#@LINE+1]]:14: error: cannot evaluate subsection number
31.subsection b-d
32# NORELAX: :[[#@LINE+2]]:14: error: subsection number -12 is not within [0,2147483647]
33# RELAX:   :[[#@LINE+1]]:14: error: cannot evaluate subsection number
34.subsection a-c
35# ERR:     :[[#@LINE+1]]:14: error: subsection number -4 is not within [0,2147483647]
36.subsection a-b
37# ERR:     :[[#@LINE+1]]:14: error: subsection number -4 is not within [0,2147483647]
38.subsection c-d
39