[llvm-dev] How to call an (x86) cleanup/catchpad funclet

Carlo Kok via llvm-dev llvm-dev at lists.llvm.org
Mon Apr 4 14:27:22 PDT 2016


I've modified llvm to emit vc++ compatible SEH structures for my 
personality on x86/Windows and my handler works fine, but the only thing 
I can't figure out is how to call these funclets, they look like:


Catch:

"?catch$3@?0?m3 at 4HA":
LBB4_3:                                 # %BasicBlock26
	pushl	%ebp
	pushl	%eax
	addl	$12, %ebp
	movl	%esp, -28(%ebp)
	movl	$LBB4_5, %eax
	addl	$4, %esp
	popl	%ebp
	retl                            # CATCHRET


cleanup:
"?dtor$2@?0?m2 at 4HA":
LBB3_2:
	pushl	%ebp
	subl	$8, %esp
	addl	$12, %ebp
	movl	%ebp, %eax
	movl	%esp, %ecx
	movl	%eax, 4(%ecx)
	movl	$1, (%ecx)
	calll	m2$Fin
	addl	$8, %esp
	popl	%ebp
	retl                            # CLEANUPRET


What do I pass to these to get a valid frame on the other end?

The cleanup one calls the finally and properly returns, but what about 
the catch?

-- 
Carlo Kok


More information about the llvm-dev mailing list