88 lines · plain
1// Test that the runtime correctly interposes ___cxa_atexit.2//3// RUN: %clang -c -o %t %s4// RUN: %llvm_jitlink %t5 6 .section __TEXT,__text,regular,pure_instructions7 .build_version macos, 12, 0 sdk_version 12, 08 9# main registers the atexit and sets the test result to one.10 .globl _main ; -- Begin function main11 .p2align 212_main: ; @main13; %bb.0:14 sub sp, sp, #32 ; =3215 stp x29, x30, [sp, #16] ; 16-byte Folded Spill16 add x29, sp, #16 ; =1617 stur wzr, [x29, #-4]18 adrp x8, __ZGVZ4mainE6onExit@PAGE19 add x8, x8, __ZGVZ4mainE6onExit@PAGEOFF20 ldarb w8, [x8]21 and w8, w8, #0x122 and w8, w8, #0xff23 cbnz w8, LBB0_324; %bb.1:25 adrp x0, __ZGVZ4mainE6onExit@PAGE26 add x0, x0, __ZGVZ4mainE6onExit@PAGEOFF27 bl ___cxa_guard_acquire28 cbz w0, LBB0_329; %bb.2:30 adrp x0, __ZN6OnExitD1Ev@GOTPAGE31 ldr x0, [x0, __ZN6OnExitD1Ev@GOTPAGEOFF]32 adrp x1, __ZZ4mainE6onExit@PAGE33 add x1, x1, __ZZ4mainE6onExit@PAGEOFF34 adrp x2, ___dso_handle@PAGE35 add x2, x2, ___dso_handle@PAGEOFF36 bl ___cxa_atexit37 adrp x0, __ZGVZ4mainE6onExit@PAGE38 add x0, x0, __ZGVZ4mainE6onExit@PAGEOFF39 bl ___cxa_guard_release40LBB0_3:41 mov x0, #142 bl _llvm_jitlink_setTestResultOverride43 mov w0, #044 ldp x29, x30, [sp, #16] ; 16-byte Folded Reload45 add sp, sp, #32 ; =3246 ret47 ; -- End function48 49# OnExit destructor resets the test result override to zero.50 .globl __ZN6OnExitD1Ev ; -- Begin function _ZN6OnExitD1Ev51 .weak_def_can_be_hidden __ZN6OnExitD1Ev52 .p2align 253__ZN6OnExitD1Ev: ; @_ZN6OnExitD1Ev54; %bb.0:55 sub sp, sp, #32 ; =3256 stp x29, x30, [sp, #16] ; 16-byte Folded Spill57 add x29, sp, #16 ; =1658 str x0, [sp, #8]59 ldr x0, [sp, #8]60 str x0, [sp] ; 8-byte Folded Spill61 bl __ZN6OnExitD2Ev62 ldr x0, [sp] ; 8-byte Folded Reload63 ldp x29, x30, [sp, #16] ; 16-byte Folded Reload64 add sp, sp, #32 ; =3265 ret66 ; -- End function67 .globl __ZN6OnExitD2Ev ; -- Begin function _ZN6OnExitD2Ev68 .weak_def_can_be_hidden __ZN6OnExitD2Ev69 .p2align 270__ZN6OnExitD2Ev: ; @_ZN6OnExitD2Ev71; %bb.0:72 sub sp, sp, #32 ; =3273 stp x29, x30, [sp, #16] ; 16-byte Folded Spill74 add x29, sp, #16 ; =1675 str x0, [sp, #8]76 ldr x8, [sp, #8]77 str x8, [sp] ; 8-byte Folded Spill78 mov x0, #079 bl _llvm_jitlink_setTestResultOverride80 ldr x0, [sp] ; 8-byte Folded Reload81 ldp x29, x30, [sp, #16] ; 16-byte Folded Reload82 add sp, sp, #32 ; =3283 ret84 ; -- End function85.zerofill __DATA,__bss,__ZZ4mainE6onExit,1,0 ; @_ZZ4mainE6onExit86.zerofill __DATA,__bss,__ZGVZ4mainE6onExit,8,3 ; @_ZGVZ4mainE6onExit87.subsections_via_symbols88