[docs] Fix build-docs.sh
[llvm-project.git] / compiler-rt / test / orc / TestCases / Linux / aarch64 / trivial-atexit.S
blob338b052dd3a37efe4dcc0c649581e6b5ca1b579a
1 // Test that the runtime correctly interposes atexit.
2 //
3 // RUN: %clang -c -o %t %s
4 // RUN: %llvm_jitlink %t
6         .text
7 // OnExit destructor resets the test result override to zero.
8         .globl  on_exit
9         .p2align        2
10         .type   on_exit,@function
11 on_exit:
13         mov     w0, wzr
14         b       llvm_jitlink_setTestResultOverride
15 .Lfunc_end0:
16         .size   on_exit, .Lfunc_end0-on_exit
18 // main registers the atexit and sets the test result to one.
19         .globl  main
20         .p2align        2
21         .type   main,@function
22 main:
24         stp     x29, x30, [sp, #-16]!
25         mov     x29, sp
26         adrp    x0, :got:on_exit
27         ldr     x0, [x0, :got_lo12:on_exit]
28         bl      atexit
29         mov     w0, wzr
30         ldp     x29, x30, [sp], #16
31         ret
32 .Lfunc_end1:
33         .size   main, .Lfunc_end1-main