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// Destructor resets the test result override to zero.8 .globl on_exit9 .p2align 210 .type on_exit,@function11on_exit:12 13 mov w0, wzr14 b llvm_jitlink_setTestResultOverride15.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 stp x29, x30, [sp, #-16]!25 mov x29, sp26 adrp x8, :got:__dso_handle27 adrp x0, :got:on_exit28 mov x1, xzr29 ldr x8, [x8, :got_lo12:__dso_handle]30 ldr x2, [x8]31 ldr x0, [x0, :got_lo12:on_exit]32 bl __cxa_atexit33 mov w0, #134 bl llvm_jitlink_setTestResultOverride35 mov w0, wzr36 ldp x29, x30, [sp], #1637 ret38.Lfunc_end1:39 .size main, .Lfunc_end1-main40