41 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// Destructor resets the test result override to zero.8 .globl on_exit9 .p2align 210 .type on_exit,@function11on_exit:12 13 move $a0, $zero14 b %plt(llvm_jitlink_setTestResultOverride)15.Lfunc_end0:16 .size on_exit, .Lfunc_end0-on_exit17 18// main registers the atexit and sets the test result to one.19 .globl main20 .p2align 221 .type main,@function22main:23 24 addi.d $sp, $sp, -1625 st.d $ra, $sp, 8 # 8-byte Folded Spill26 pcalau12i $a0, %got_pc_hi20(__dso_handle)27 ld.d $a0, $a0, %got_pc_lo12(__dso_handle)28 ld.d $a2, $a0, 029 pcalau12i $a0, %pc_hi20(on_exit)30 addi.d $a0, $a0, %pc_lo12(on_exit)31 move $a1, $zero32 bl %plt(__cxa_atexit)33 ori $a0, $zero, 134 bl %plt(llvm_jitlink_setTestResultOverride)35 move $a0, $zero36 ld.d $ra, $sp, 8 # 8-byte Folded Reload37 addi.d $sp, $sp, 1638 ret39.Lfunc_end1:40 .size main, .Lfunc_end1-main41