blob: 16852c6e1ab4901b1659ca29f668e3c6842fb990 [file] [log] [blame]
// Test that the runtime correctly interposes atexit.
//
// RUN: %clang -c -o %t %s
// RUN: %llvm_jitlink %t
.text
// OnExit destructor resets the test result override to zero.
.section .text._ZN6OnExitD2Ev,"axG",@progbits,_ZN6OnExitD2Ev,comdat
.p2align 4, 0x90
.type _ZN6OnExitD2Ev,@function
_ZN6OnExitD2Ev: # @_ZN6OnExitD2Ev
.cfi_startproc
xorl %edi, %edi
jmp llvm_jitlink_setTestResultOverride@PLT # TAILCALL
.cfi_endproc
// main registers the atexit and sets the test result to one.
.globl main
.p2align 4, 0x90 # -- Begin function main
.type main,@function
main: # @main
.cfi_startproc
# %bb.0:
movq _ZN6OnExitD2Ev@GOTPCREL(%rip), %rdi
callq atexit@PLT
movl $1, %edi
callq llvm_jitlink_setTestResultOverride@PLT
xorl %eax, %eax
retq
.Lfunc_end1:
.size main, .Lfunc_end1-main
.cfi_endproc
# -- End function
.type _ZL6onExit,@object # @_ZL6onExit
.local _ZL6onExit
.comm _ZL6onExit,1,1