1// Test that the runtime correctly interposes ___cxa_atexit.
2//
3// RUN: %clang -c -o %t %s
4// RUN: %llvm_jitlink %t
5 .text
6 .abiversion 2
7 .file "cxa-atexit.c"
8 .globl on_exit_hook
9 .p2align 4
10 .type on_exit_hook,@function
11on_exit_hook:
12.Lfunc_begin0:
13.Lfunc_gep0:
14 addis 2, 12, .TOC.-.Lfunc_gep0@ha
15 addi 2, 2, .TOC.-.Lfunc_gep0@l
16.Lfunc_lep0:
17 .localentry on_exit_hook, .Lfunc_lep0-.Lfunc_gep0
18 mflr 0
19 stdu 1, -32(1)
20 std 0, 48(1)
21 li 3, 0
22 bl llvm_jitlink_setTestResultOverride
23 nop
24 addi 1, 1, 32
25 ld 0, 16(1)
26 mtlr 0
27 blr
28 .long 0
29 .quad 0
30.Lfunc_end0:
31 .size on_exit_hook, .Lfunc_end0-.Lfunc_begin0
32
33 .globl main
34 .p2align 4
35 .type main,@function
36main:
37.Lfunc_begin1:
38.Lfunc_gep1:
39 addis 2, 12, .TOC.-.Lfunc_gep1@ha
40 addi 2, 2, .TOC.-.Lfunc_gep1@l
41.Lfunc_lep1:
42 .localentry main, .Lfunc_lep1-.Lfunc_gep1
43 mflr 0
44 stdu 1, -32(1)
45 std 0, 48(1)
46 addis 3, 2, on_exit_hook@toc@ha
47 addi 3, 3, on_exit_hook@toc@l
48 li 4, 0
49 addis 5, 2, __dso_handle@toc@ha
50 addi 5, 5, __dso_handle@toc@l
51 bl __cxa_atexit
52 nop
53 li 3, 1
54 bl llvm_jitlink_setTestResultOverride
55 nop
56 li 3, 0
57 addi 1, 1, 32
58 ld 0, 16(1)
59 mtlr 0
60 blr
61 .long 0
62 .quad 0
63.Lfunc_end1:
64 .size main, .Lfunc_end1-.Lfunc_begin1
65
66 .hidden __dso_handle
67

source code of compiler-rt/test/orc/TestCases/Linux/ppc64/trivial-cxa-atexit.S