xref: /llvm-project/llvm/test/MC/ELF/subsection.s (revision 6746602bc6427300735af52284928c4a8c84875b)
1// RUN: llvm-mc -filetype=obj %s -o - -triple x86_64-pc-linux | llvm-objdump -s - | FileCheck %s
2// RUN: not llvm-mc -filetype=obj -triple x86_64 --defsym ERR=1 %s -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR --implicit-check-not=error:
3
4// CHECK: Contents of section .text:
5// CHECK-NEXT: 0000 03042502 00000003 04250100 0000ebf7
6.text 1
7add 1, %eax
8jmp label
9.subsection
10add 2, %eax
11label:
12
13// CHECK-NOT: Contents of section .rela.text:
14
15// CHECK: Contents of section .data:
16// CHECK-NEXT: 0000 01030402 74657374
17.data
18l0:
19.byte 1
20.subsection 1+1
21l1:
22.byte 2
23l2:
24.subsection l2-l1
25.byte l1-l0
26.subsection 3
27.ascii "test"
28.previous
29.byte 4
30
31// CHECK: Contents of section test:
32// CHECK-NEXT: 0000 010302
33.section test
34.byte 1
35.pushsection test, 1
36.byte 2
37.popsection
38.byte 3
39
40
41.ifdef ERR
42// ERR: :[[#@LINE+1]]:13: error: cannot evaluate subsection number
43.subsection l2
44
45// ERR: <unknown>:0: error: subsection number -1 is not within [0,2147483647]
46.subsection 0-1
47.subsection 2147483647
48// ERR: <unknown>:0: error: subsection number 2147483648 is not within [0,2147483647]
49.subsection 2147483648
50.endif
51