xref: /aosp_15_r20/external/llvm/test/MC/ARM/eh-directive-cantunwind-diagnostics.s (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker@ RUN: not llvm-mc -triple=armv7-unknown-linux-gnueabi < %s 2> %t
2*9880d681SAndroid Build Coastguard Worker@ RUN: FileCheck < %t %s
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Worker@ Check the diagnostics for .cantunwind, .handlerdata, and .personality
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Worker@ .cantunwind directive can't be used with .handlerdata directive nor
7*9880d681SAndroid Build Coastguard Worker@ .personality directive.  This test case check for the diagnostics for
8*9880d681SAndroid Build Coastguard Worker@ the conflicts.
9*9880d681SAndroid Build Coastguard Worker
10*9880d681SAndroid Build Coastguard Worker
11*9880d681SAndroid Build Coastguard Worker        .syntax unified
12*9880d681SAndroid Build Coastguard Worker        .text
13*9880d681SAndroid Build Coastguard Worker
14*9880d681SAndroid Build Coastguard Worker@-------------------------------------------------------------------------------
15*9880d681SAndroid Build Coastguard Worker@ TEST1: cantunwind + personality
16*9880d681SAndroid Build Coastguard Worker@-------------------------------------------------------------------------------
17*9880d681SAndroid Build Coastguard Worker        .globl  func1
18*9880d681SAndroid Build Coastguard Worker        .align  2
19*9880d681SAndroid Build Coastguard Worker        .type   func1,%function
20*9880d681SAndroid Build Coastguard Worker        .fnstart
21*9880d681SAndroid Build Coastguard Workerfunc1:
22*9880d681SAndroid Build Coastguard Worker        .cantunwind
23*9880d681SAndroid Build Coastguard Worker        .personality    __gxx_personality_v0
24*9880d681SAndroid Build Coastguard Worker@ CHECK: error: .personality can't be used with .cantunwind directive
25*9880d681SAndroid Build Coastguard Worker@ CHECK:        .personality __gxx_personality_v0
26*9880d681SAndroid Build Coastguard Worker@ CHECK:        ^
27*9880d681SAndroid Build Coastguard Worker@ CHECK: note: .cantunwind was specified here
28*9880d681SAndroid Build Coastguard Worker@ CHECK:        .cantunwind
29*9880d681SAndroid Build Coastguard Worker@ CHECK:        ^
30*9880d681SAndroid Build Coastguard Worker        .fnend
31*9880d681SAndroid Build Coastguard Worker
32*9880d681SAndroid Build Coastguard Worker
33*9880d681SAndroid Build Coastguard Worker
34*9880d681SAndroid Build Coastguard Worker@-------------------------------------------------------------------------------
35*9880d681SAndroid Build Coastguard Worker@ TEST2: cantunwind + handlerdata
36*9880d681SAndroid Build Coastguard Worker@-------------------------------------------------------------------------------
37*9880d681SAndroid Build Coastguard Worker        .globl  func2
38*9880d681SAndroid Build Coastguard Worker        .align  2
39*9880d681SAndroid Build Coastguard Worker        .type   func2,%function
40*9880d681SAndroid Build Coastguard Worker        .fnstart
41*9880d681SAndroid Build Coastguard Workerfunc2:
42*9880d681SAndroid Build Coastguard Worker        .cantunwind
43*9880d681SAndroid Build Coastguard Worker        .handlerdata
44*9880d681SAndroid Build Coastguard Worker@ CHECK: error: .handlerdata can't be used with .cantunwind directive
45*9880d681SAndroid Build Coastguard Worker@ CHECK:        .handlerdata
46*9880d681SAndroid Build Coastguard Worker@ CHECK:        ^
47*9880d681SAndroid Build Coastguard Worker@ CHECK: note: .cantunwind was specified here
48*9880d681SAndroid Build Coastguard Worker@ CHECK:        .cantunwind
49*9880d681SAndroid Build Coastguard Worker@ CHECK:        ^
50*9880d681SAndroid Build Coastguard Worker        .fnend
51*9880d681SAndroid Build Coastguard Worker
52*9880d681SAndroid Build Coastguard Worker
53*9880d681SAndroid Build Coastguard Worker
54*9880d681SAndroid Build Coastguard Worker@-------------------------------------------------------------------------------
55*9880d681SAndroid Build Coastguard Worker@ TEST3: personality + cantunwind
56*9880d681SAndroid Build Coastguard Worker@-------------------------------------------------------------------------------
57*9880d681SAndroid Build Coastguard Worker        .globl  func3
58*9880d681SAndroid Build Coastguard Worker        .align  2
59*9880d681SAndroid Build Coastguard Worker        .type   func3,%function
60*9880d681SAndroid Build Coastguard Worker        .fnstart
61*9880d681SAndroid Build Coastguard Workerfunc3:
62*9880d681SAndroid Build Coastguard Worker        .personality    __gxx_personality_v0
63*9880d681SAndroid Build Coastguard Worker        .cantunwind
64*9880d681SAndroid Build Coastguard Worker@ CHECK: error: .cantunwind can't be used with .personality directive
65*9880d681SAndroid Build Coastguard Worker@ CHECK:        .cantunwind
66*9880d681SAndroid Build Coastguard Worker@ CHECK:        ^
67*9880d681SAndroid Build Coastguard Worker@ CHECK: note: .personality was specified here
68*9880d681SAndroid Build Coastguard Worker@ CHECK:        .personality __gxx_personality_v0
69*9880d681SAndroid Build Coastguard Worker@ CHECK:        ^
70*9880d681SAndroid Build Coastguard Worker        .fnend
71*9880d681SAndroid Build Coastguard Worker
72*9880d681SAndroid Build Coastguard Worker
73*9880d681SAndroid Build Coastguard Worker
74*9880d681SAndroid Build Coastguard Worker@-------------------------------------------------------------------------------
75*9880d681SAndroid Build Coastguard Worker@ TEST4: handlerdata + cantunwind
76*9880d681SAndroid Build Coastguard Worker@-------------------------------------------------------------------------------
77*9880d681SAndroid Build Coastguard Worker        .globl  func4
78*9880d681SAndroid Build Coastguard Worker        .align  2
79*9880d681SAndroid Build Coastguard Worker        .type   func4,%function
80*9880d681SAndroid Build Coastguard Worker        .fnstart
81*9880d681SAndroid Build Coastguard Workerfunc4:
82*9880d681SAndroid Build Coastguard Worker        .handlerdata
83*9880d681SAndroid Build Coastguard Worker        .cantunwind
84*9880d681SAndroid Build Coastguard Worker@ CHECK: error: .cantunwind can't be used with .handlerdata directive
85*9880d681SAndroid Build Coastguard Worker@ CHECK:        .cantunwind
86*9880d681SAndroid Build Coastguard Worker@ CHECK:        ^
87*9880d681SAndroid Build Coastguard Worker@ CHECK: note: .handlerdata was specified here
88*9880d681SAndroid Build Coastguard Worker@ CHECK:        .handlerdata
89*9880d681SAndroid Build Coastguard Worker@ CHECK:        ^
90*9880d681SAndroid Build Coastguard Worker        .fnend
91*9880d681SAndroid Build Coastguard Worker
92*9880d681SAndroid Build Coastguard Worker
93*9880d681SAndroid Build Coastguard Worker
94*9880d681SAndroid Build Coastguard Worker@-------------------------------------------------------------------------------
95*9880d681SAndroid Build Coastguard Worker@ TEST5: cantunwind + fnstart
96*9880d681SAndroid Build Coastguard Worker@-------------------------------------------------------------------------------
97*9880d681SAndroid Build Coastguard Worker        .globl  func5
98*9880d681SAndroid Build Coastguard Worker        .align  2
99*9880d681SAndroid Build Coastguard Worker        .type   func5,%function
100*9880d681SAndroid Build Coastguard Worker        .cantunwind
101*9880d681SAndroid Build Coastguard Worker@ CHECK: error: .fnstart must precede .cantunwind directive
102*9880d681SAndroid Build Coastguard Worker@ CHECK:        .cantunwind
103*9880d681SAndroid Build Coastguard Worker@ CHECK:        ^
104*9880d681SAndroid Build Coastguard Worker        .fnstart
105*9880d681SAndroid Build Coastguard Workerfunc5:
106*9880d681SAndroid Build Coastguard Worker        .fnend
107