40 lines · plain
1// Test that the runtime correctly interposes ___cxa_atexit.2//3// RUN: %clang -c -o %t %s4// RUN: %llvm_jitlink %t5 6 .text7// OnExit destructor resets the test result override to zero.8 .section .text._ZN6OnExitD2Ev,"axG",@progbits,_ZN6OnExitD2Ev,comdat9 .p2align 4, 0x9010 .type _ZN6OnExitD2Ev,@function11_ZN6OnExitD2Ev: # @_ZN6OnExitD2Ev12 .cfi_startproc13 xorl %edi, %edi14 jmp llvm_jitlink_setTestResultOverride@PLT # TAILCALL15 .cfi_endproc16 17// main registers the atexit and sets the test result to one.18 .globl main19 .p2align 4, 0x90 # -- Begin function main20 .type main,@function21main: # @main22 .cfi_startproc23# %bb.0:24 movq _ZN6OnExitD2Ev@GOTPCREL(%rip), %rdi25 leaq _ZL6onExit(%rip), %rsi26 leaq __dso_handle(%rip), %rdx27 callq __cxa_atexit@PLT28 movl $1, %edi29 callq llvm_jitlink_setTestResultOverride@PLT30 xorl %eax, %eax31 retq32.Lfunc_end1:33 .size main, .Lfunc_end1-main34 .cfi_endproc35 # -- End function36 .type _ZL6onExit,@object # @_ZL6onExit37 .local _ZL6onExit38 .comm _ZL6onExit,1,139 .hidden __dso_handle40