llvm.org GIT mirror llvm / c6d1cc7
[WinEH] Strip the \01 character from the __CxxFrameHandler3 thunk name Add another C++ 32-bit EH table test. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242044 91177308-0d34-0410-b5e6-96231b3b80d8 Reid Kleckner 5 years ago
2 changed file(s) with 76 addition(s) and 53 deletion(s). Raw diff Collapse all Expand all
335335 FunctionType *TargetFuncTy =
336336 FunctionType::get(Int32Ty, makeArrayRef(&ArgTys[0], 5),
337337 /*isVarArg=*/false);
338 Function *Trampoline = Function::Create(
339 TrampolineTy, GlobalValue::InternalLinkage,
340 Twine("__ehhandler$") + ParentFunc->getName(), TheModule);
338 Function *Trampoline =
339 Function::Create(TrampolineTy, GlobalValue::InternalLinkage,
340 Twine("__ehhandler$") + GlobalValue::getRealLinkageName(
341 ParentFunc->getName()),
342 TheModule);
341343 BasicBlock *EntryBB = BasicBlock::Create(Context, "entry", Trampoline);
342344 IRBuilder<> Builder(EntryBB);
343345 Value *LSDA = emitEHLSDA(Builder, ParentFunc);
None ; RUN: llc < %s | FileCheck %s
1
2 target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
3 target triple = "x86_64-pc-windows-msvc"
0 ; RUN: llc -mtriple=x86_64-windows-msvc < %s | FileCheck %s --check-prefix=CHECK --check-prefix=X64
1 ; RUN: llc -mtriple=i686-windows-msvc < %s | FileCheck %s --check-prefix=CHECK --check-prefix=X86
42
53 ; This test case is equivalent to:
64 ; void f() {
5048
5149 ; CHECK-LABEL: "?f@@YAXXZ.catch":
5250 ; No code should be generated for the indirectbr.
53 ; CHECK-NOT: jmpq *
54 ; CHECK: .seh_handlerdata
55 ; CHECK: .long ("$cppxdata$?f@@YAXXZ")@IMGREL
51 ; CHECK-NOT: jmp{{[ql]}} *
52 ; X64: .seh_handlerdata
53 ; X64-NEXT: .long ("$cppxdata$?f@@YAXXZ")@IMGREL
5654
5755
5856 define internal i8* @"\01?f@@YAXXZ.catch1"(i8*, i8*) #4 personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
7573
7674 ; CHECK-LABEL: "?f@@YAXXZ.catch1":
7775 ; No code should be generated for the indirectbr.
78 ; CHECK-NOT: jmpq *
79 ; CHECK: ".L?f@@YAXXZ.catch1$parent_frame_offset" = 16
80 ; CHECK: movq %rdx, 16(%rsp)
81 ; CHECK: .seh_handlerdata
82 ; CHECK: .long ("$cppxdata$?f@@YAXXZ")@IMGREL
76 ; CHECK-NOT: jmp{{[ql]}} *
77 ; X64: ".L?f@@YAXXZ.catch1$parent_frame_offset" = 16
78 ; X64: movq %rdx, 16(%rsp)
79 ; X64: .seh_handlerdata
80 ; X64: .long ("$cppxdata$?f@@YAXXZ")@IMGREL
8381
8482 define void @"\01?f@@YAXXZ"() #0 personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
8583 entry:
117115
118116 ; CHECK-LABEL: "?f@@YAXXZ":
119117 ; No code should be generated for the indirectbr.
120 ; CHECK-NOT: jmpq *
121 ; CHECK: .seh_handlerdata
122 ; CHECK-NEXT: .long ("$cppxdata$?f@@YAXXZ")@IMGREL
123 ; CHECK-NEXT: .align 4
124 ; CHECK-NEXT:"$cppxdata$?f@@YAXXZ":
125 ; CHECK-NEXT: .long 429065506
126 ; CHECK-NEXT: .long 4
127 ; CHECK-NEXT: .long ("$stateUnwindMap$?f@@YAXXZ")@IMGREL
128 ; CHECK-NEXT: .long 2
129 ; CHECK-NEXT: .long ("$tryMap$?f@@YAXXZ")@IMGREL
130 ; CHECK-NEXT: .long 6
131 ; CHECK-NEXT: .long ("$ip2state$?f@@YAXXZ")@IMGREL
132 ; CHECK-NEXT: .long 32
133 ; CHECK-NEXT: .long 0
134 ; CHECK-NEXT: .long 1
118 ; CHECK-NOT: jmp{{[ql]}} *
119
120 ; X64: .seh_handlerdata
121 ; X64-NEXT: .long ("$cppxdata$?f@@YAXXZ")@IMGREL
122 ; X86: .section .xdata,"dr"
123
124 ; CHECK: .align 4
125
126 ; X64: "$cppxdata$?f@@YAXXZ":
127 ; X64-NEXT: .long 429065506
128 ; X64-NEXT: .long 4
129 ; X64-NEXT: .long ("$stateUnwindMap$?f@@YAXXZ")@IMGREL
130 ; X64-NEXT: .long 2
131 ; X64-NEXT: .long ("$tryMap$?f@@YAXXZ")@IMGREL
132 ; X64-NEXT: .long 6
133 ; X64-NEXT: .long ("$ip2state$?f@@YAXXZ")@IMGREL
134 ; X64-NEXT: .long 32
135 ; X64-NEXT: .long 0
136 ; X64-NEXT: .long 1
137
138 ; X86: "L__ehtable$?f@@YAXXZ":
139 ; X86-NEXT: .long 429065506
140 ; X86-NEXT: .long 4
141 ; X86-NEXT: .long ("$stateUnwindMap$?f@@YAXXZ")
142 ; X86-NEXT: .long 2
143 ; X86-NEXT: .long ("$tryMap$?f@@YAXXZ")
144 ; X86-NEXT: .long 0
145 ; X86-NEXT: .long 0
146 ; X86-NEXT: .long 0
147 ; X86-NEXT: .long 1
148
149
135150 ; CHECK-NEXT:"$stateUnwindMap$?f@@YAXXZ":
136151 ; CHECK-NEXT: .long -1
137152 ; CHECK-NEXT: .long 0
146161 ; CHECK-NEXT: .long 1
147162 ; CHECK-NEXT: .long 2
148163 ; CHECK-NEXT: .long 1
149 ; CHECK-NEXT: .long ("$handlerMap$0$?f@@YAXXZ")@IMGREL
164 ; CHECK-NEXT: .long ("$handlerMap$0$?f@@YAXXZ")
150165 ; CHECK-NEXT: .long 0
151166 ; CHECK-NEXT: .long 2
152167 ; CHECK-NEXT: .long 3
153168 ; CHECK-NEXT: .long 1
154 ; CHECK-NEXT: .long ("$handlerMap$1$?f@@YAXXZ")@IMGREL
169 ; CHECK-NEXT: .long ("$handlerMap$1$?f@@YAXXZ")
155170 ; CHECK-NEXT:"$handlerMap$0$?f@@YAXXZ":
156171 ; CHECK-NEXT: .long 8
157 ; CHECK-NEXT: .long "??_R0H@8"@IMGREL
158 ; CHECK-NEXT: .long ".L?f@@YAXXZ$frame_escape_0"
159 ; CHECK-NEXT: .long "?f@@YAXXZ.catch"@IMGREL
160 ; CHECK-NEXT: .long ".L?f@@YAXXZ.catch$parent_frame_offset"
172 ; CHECK-NEXT: .long "??_R0H@8"
173 ; CHECK-NEXT: .long "{{.?}}L?f@@YAXXZ$frame_escape_0"
174 ; CHECK-NEXT: .long "?f@@YAXXZ.catch"
175 ; X64-NEXT: .long ".L?f@@YAXXZ.catch$parent_frame_offset"
161176 ; CHECK-NEXT:"$handlerMap$1$?f@@YAXXZ":
162177 ; CHECK-NEXT: .long 0
163 ; CHECK-NEXT: .long "??_R0N@8"@IMGREL
164 ; CHECK-NEXT: .long ".L?f@@YAXXZ$frame_escape_1"
165 ; CHECK-NEXT: .long "?f@@YAXXZ.catch1"@IMGREL
166 ; CHECK-NEXT: .long ".L?f@@YAXXZ.catch1$parent_frame_offset"
167 ; CHECK-NEXT:"$ip2state$?f@@YAXXZ":
168 ; CHECK-NEXT: .long .Lfunc_begin0@IMGREL
169 ; CHECK-NEXT: .long 2
170 ; CHECK-NEXT: .long .Ltmp0@IMGREL
171 ; CHECK-NEXT: .long 0
172 ; CHECK-NEXT: .long .Lfunc_begin1@IMGREL
173 ; CHECK-NEXT: .long 3
174 ; CHECK-NEXT: .long .Lfunc_begin2@IMGREL
175 ; CHECK-NEXT: .long -1
176 ; CHECK-NEXT: .long .Ltmp13@IMGREL
177 ; CHECK-NEXT: .long 1
178 ; CHECK-NEXT: .long .Ltmp16@IMGREL
179 ; CHECK-NEXT: .long 0
178 ; CHECK-NEXT: .long "??_R0N@8"
179 ; CHECK-NEXT: .long "{{.?}}L?f@@YAXXZ$frame_escape_1"
180 ; CHECK-NEXT: .long "?f@@YAXXZ.catch1"
181 ; X64-NEXT: .long ".L?f@@YAXXZ.catch1$parent_frame_offset"
182
183 ; X64-NEXT:"$ip2state$?f@@YAXXZ":
184 ; X64-NEXT: .long .Lfunc_begin0
185 ; X64-NEXT: .long 2
186 ; X64-NEXT: .long .Ltmp0
187 ; X64-NEXT: .long 0
188 ; X64-NEXT: .long .Lfunc_begin1
189 ; X64-NEXT: .long 3
190 ; X64-NEXT: .long .Lfunc_begin2
191 ; X64-NEXT: .long -1
192 ; X64-NEXT: .long .Ltmp13
193 ; X64-NEXT: .long 1
194 ; X64-NEXT: .long .Ltmp16
195 ; X64-NEXT: .long 0
196
197
198 ; X86: "___ehhandler$?f@@YAXXZ": # @"__ehhandler$?f@@YAXXZ"
199 ; X86: movl $"L__ehtable$?f@@YAXXZ", %eax
200 ; X86: jmp ___CxxFrameHandler3 # TAILCALL
180201
181202
182203 declare void @"\01?may_throw@@YAXXZ"() #1