34 lines · plain
1// Test that the runtime correctly interposes 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 .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 x0, :got:on_exit27 ldr x0, [x0, :got_lo12:on_exit]28 bl atexit29 mov w0, wzr30 ldp x29, x30, [sp], #1631 ret32.Lfunc_end1:33 .size main, .Lfunc_end1-main34