aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/CodeGen/PowerPC/aix-xcoff-exception-section.ll
blob: fbcb62a49f9720df1a23ea4c2287363c826720fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
; Testing 32-bit and 64-bit exception section entries, no exception auxilliary
; entries should be produced as no debug information is specified.
; RUN: llc -mtriple=powerpc-ibm-aix-xcoff -mcpu=ppc -filetype=obj -o %t_32.o < %s
; RUN: llvm-readobj --exception-section %t_32.o | FileCheck %s --check-prefix=EXCEPT
; RUN: llvm-readobj --section-headers %t_32.o | FileCheck %s --check-prefix=READ
; RUN: llvm-readobj --syms %t_32.o | FileCheck %s --check-prefix=SYMS

; RUN: llc -mtriple=powerpc64-unknown-aix -mcpu=ppc -filetype=obj -o %t_64.o < %s
; RUN: llvm-readobj --exception-section %t_64.o | FileCheck %s --check-prefix=EXCEPT64
; RUN: llvm-readobj --section-headers %t_64.o | FileCheck %s --check-prefix=READ64
; RUN: llvm-readobj --syms %t_64.o | FileCheck %s --check-prefix=SYMS64

!1 = !{!"ppc-trap-reason", !"1", !"2"}
declare void @llvm.ppc.trap(i32 %a)
define dso_local void @sub_test() {
  call void @llvm.ppc.trap(i32 1), !annotation !1
  ret void
}
define dso_local void @test__trap_annotation(i32 %a) {
  call void @llvm.ppc.trap(i32 %a), !annotation !1
  call void @sub_test()
  call void @llvm.ppc.trap(i32 %a), !annotation !1
  ret void
}

; EXCEPT:       Exception section {
; EXCEPT-NEXT:    Symbol: .sub_test
; EXCEPT-NEXT:    LangID: 0
; EXCEPT-NEXT:    Reason: 0
; EXCEPT-NEXT:    Trap Instr Addr: 0x4
; EXCEPT-NEXT:    LangID: 1
; EXCEPT-NEXT:    Reason: 2
; EXCEPT-NEXT:    Symbol: .test__trap_annotation
; EXCEPT-NEXT:    LangID: 0
; EXCEPT-NEXT:    Reason: 0
; EXCEPT-NEXT:    Trap Instr Addr: 0x3C
; EXCEPT-NEXT:    LangID: 1
; EXCEPT-NEXT:    Reason: 2
; EXCEPT-NEXT:    Trap Instr Addr: 0x44
; EXCEPT-NEXT:    LangID: 1
; EXCEPT-NEXT:    Reason: 2
; EXCEPT-NEXT:  }

; There are multiple "Section {" lines in the readobj output so we need to start this READ check
; on a unique line (Type: STYP_DATA (0x40)) so that the checks know where to start reading
; READ:           Type: STYP_DATA (0x40)
; READ-NEXT:    }
; READ-NEXT:    Section {
; READ-NEXT:      Index: 3
; READ-NEXT:      Name: .except
; READ-NEXT:      PhysicalAddress: 0x0
; READ-NEXT:      VirtualAddress: 0x0
; READ-NEXT:      Size: 0x1E
; READ-NEXT:      RawDataOffset: 0x12C
; READ-NEXT:      RelocationPointer: 0x0
; READ-NEXT:      LineNumberPointer: 0x0
; READ-NEXT:      NumberOfRelocations: 0
; READ-NEXT:      NumberOfLineNumbers: 0
; READ-NEXT:      Type: STYP_EXCEPT (0x100)
; READ-NEXT:    }
; READ-NEXT:  ]

; SYMS:           Index: [[#IND:]]{{.*}}{{[[:space:]] *}}Name: .sub_test
; SYMS-NEXT:      Value (RelocatableAddress): 0x0
; SYMS-NEXT:      Section: .text
; SYMS-NEXT:      Type: 0x20
; SYMS-NEXT:      StorageClass: C_EXT (0x2)
; SYMS-NEXT:      NumberOfAuxEntries: 2
; SYMS-NEXT:      Function Auxiliary Entry {
; SYMS-NEXT:        Index: [[#IND+1]]
; SYMS-NEXT:        OffsetToExceptionTable: 0x12C
; SYMS-NEXT:        SizeOfFunction: 0xC
; SYMS-NEXT:        PointerToLineNum: 0x0
; SYMS-NEXT:        SymbolIndexOfNextBeyond: [[#IND+3]]
; SYMS-NEXT:      }
; SYMS-NEXT:      CSECT Auxiliary Entry {
; SYMS-NEXT:        Index: [[#IND+2]]
; SYMS-NEXT:        ContainingCsectSymbolIndex: [[#IND-2]]
; SYMS-NEXT:        ParameterHashIndex: 0x0
; SYMS-NEXT:        TypeChkSectNum: 0x0
; SYMS-NEXT:        SymbolAlignmentLog2: 0
; SYMS-NEXT:        SymbolType: XTY_LD (0x2)
; SYMS-NEXT:        StorageMappingClass: XMC_PR (0x0)
; SYMS-NEXT:        StabInfoIndex: 0x0
; SYMS-NEXT:        StabSectNum: 0x0
; SYMS-NEXT:      }
; SYMS-NEXT:    }
; SYMS-NEXT:    Symbol {
; SYMS-NEXT:      Index: [[#IND+3]]
; SYMS-NEXT:      Name: .test__trap_annotation
; SYMS-NEXT:      Value (RelocatableAddress): 0x28
; SYMS-NEXT:      Section: .text
; SYMS-NEXT:      Type: 0x20
; SYMS-NEXT:      StorageClass: C_EXT (0x2)
; SYMS-NEXT:      NumberOfAuxEntries: 2
; SYMS-NEXT:      Function Auxiliary Entry {
; SYMS-NEXT:        Index: [[#IND+4]]
; SYMS-NEXT:        OffsetToExceptionTable: 0x138
; SYMS-NEXT:        SizeOfFunction: 0x34
; SYMS-NEXT:        PointerToLineNum: 0x0
; SYMS-NEXT:        SymbolIndexOfNextBeyond: [[#IND+6]]
; SYMS-NEXT:      }
; SYMS-NEXT:      CSECT Auxiliary Entry {
; SYMS-NEXT:        Index: [[#IND+5]]
; SYMS-NEXT:        ContainingCsectSymbolIndex: [[#IND-2]]
; SYMS-NEXT:        ParameterHashIndex: 0x0
; SYMS-NEXT:        TypeChkSectNum: 0x0
; SYMS-NEXT:        SymbolAlignmentLog2: 0
; SYMS-NEXT:        SymbolType: XTY_LD (0x2)
; SYMS-NEXT:        StorageMappingClass: XMC_PR (0x0)
; SYMS-NEXT:        StabInfoIndex: 0x0
; SYMS-NEXT:        StabSectNum: 0x0
; SYMS-NEXT:      }
; SYMS-NEXT:    }

; EXCEPT64:       Exception section {
; EXCEPT64-NEXT:    Symbol: .sub_test
; EXCEPT64-NEXT:    LangID: 0
; EXCEPT64-NEXT:    Reason: 0
; EXCEPT64-NEXT:    Trap Instr Addr: 0x4
; EXCEPT64-NEXT:    LangID: 1
; EXCEPT64-NEXT:    Reason: 2
; EXCEPT64-NEXT:    Symbol: .test__trap_annotation
; EXCEPT64-NEXT:    LangID: 0
; EXCEPT64-NEXT:    Reason: 0
; EXCEPT64-NEXT:    Trap Instr Addr: 0x3C
; EXCEPT64-NEXT:    LangID: 1
; EXCEPT64-NEXT:    Reason: 2
; EXCEPT64-NEXT:    Trap Instr Addr: 0x44
; EXCEPT64-NEXT:    LangID: 1
; EXCEPT64-NEXT:    Reason: 2
; EXCEPT64-NEXT:  }

; READ64:           Type: STYP_DATA (0x40)
; READ64-NEXT:    }
; READ64-NEXT:    Section {
; READ64-NEXT:      Index: 3
; READ64-NEXT:      Name: .except
; READ64-NEXT:      PhysicalAddress: 0x0
; READ64-NEXT:      VirtualAddress: 0x0
; READ64-NEXT:      Size: 0x32
; READ64-NEXT:      RawDataOffset: 0x1A8
; READ64-NEXT:      RelocationPointer: 0x0
; READ64-NEXT:      LineNumberPointer: 0x0
; READ64-NEXT:      NumberOfRelocations: 0
; READ64-NEXT:      NumberOfLineNumbers: 0
; READ64-NEXT:      Type: STYP_EXCEPT (0x100)
; READ64-NEXT:    }
; READ64-NEXT:  ]

; SYMS64:           Index: [[#IND:]]{{.*}}{{[[:space:]] *}}Name: .sub_test
; SYMS64-NEXT:      Value (RelocatableAddress): 0x0
; SYMS64-NEXT:      Section: .text
; SYMS64-NEXT:      Type: 0x0
; SYMS64-NEXT:      StorageClass: C_EXT (0x2)
; SYMS64-NEXT:      NumberOfAuxEntries: 2
; SYMS64-NEXT:      Function Auxiliary Entry {
; SYMS64-NEXT:        Index: [[#IND+1]]
; SYMS64-NEXT:        SizeOfFunction: 0x18
; SYMS64-NEXT:        PointerToLineNum: 0x0
; SYMS64-NEXT:        SymbolIndexOfNextBeyond: [[#IND+3]]
; SYMS64-NEXT:        Auxiliary Type: AUX_FCN (0xFE)
; SYMS64-NEXT:      }
; SYMS64-NEXT:      CSECT Auxiliary Entry {
; SYMS64-NEXT:        Index: [[#IND+2]]
; SYMS64-NEXT:        ContainingCsectSymbolIndex: [[#IND-2]]
; SYMS64-NEXT:        ParameterHashIndex: 0x0
; SYMS64-NEXT:        TypeChkSectNum: 0x0
; SYMS64-NEXT:        SymbolAlignmentLog2: 0
; SYMS64-NEXT:        SymbolType: XTY_LD (0x2)
; SYMS64-NEXT:        StorageMappingClass: XMC_PR (0x0)
; SYMS64-NEXT:        Auxiliary Type: AUX_CSECT (0xFB)
; SYMS64-NEXT:      }
; SYMS64-NEXT:    }
; SYMS64-NEXT:    Symbol {
; SYMS64-NEXT:      Index: [[#IND+3]]
; SYMS64-NEXT:      Name: .test__trap_annotation
; SYMS64-NEXT:      Value (RelocatableAddress): 0x28
; SYMS64-NEXT:      Section: .text
; SYMS64-NEXT:      Type: 0x0
; SYMS64-NEXT:      StorageClass: C_EXT (0x2)
; SYMS64-NEXT:      NumberOfAuxEntries: 2
; SYMS64-NEXT:      Function Auxiliary Entry {
; SYMS64-NEXT:        Index: [[#IND+4]]
; SYMS64-NEXT:        SizeOfFunction: 0x68
; SYMS64-NEXT:        PointerToLineNum: 0x0
; SYMS64-NEXT:        SymbolIndexOfNextBeyond: [[#IND+6]]
; SYMS64-NEXT:        Auxiliary Type: AUX_FCN (0xFE)
; SYMS64-NEXT:      }
; SYMS64-NEXT:      CSECT Auxiliary Entry {
; SYMS64-NEXT:        Index: [[#IND+5]]
; SYMS64-NEXT:        ContainingCsectSymbolIndex: [[#IND-2]]
; SYMS64-NEXT:        ParameterHashIndex: 0x0
; SYMS64-NEXT:        TypeChkSectNum: 0x0
; SYMS64-NEXT:        SymbolAlignmentLog2: 0
; SYMS64-NEXT:        SymbolType: XTY_LD (0x2)
; SYMS64-NEXT:        StorageMappingClass: XMC_PR (0x0)
; SYMS64-NEXT:        Auxiliary Type: AUX_CSECT (0xFB)
; SYMS64-NEXT:      }
; SYMS64-NEXT:    }