70 lines · plain
1// Test that the runtime correctly interposes atexit.2//3// REQUIRES: disabled4// This test is disabled until a proper atexit interpose can be implemented:5// the current one assumes that atexit is defined in the dylib that calls it,6// which is not true in general. See7// https://github.com/llvm/llvm-project/issues/74641.8//9// RUN: %clang -c -o %t %s10// RUN: %llvm_jitlink %t11 12 .text13 .abiversion 214// on_exit_hook destructor resets the test result override to zero.15 .globl on_exit_hook16 .p2align 417 .type on_exit_hook,@function18on_exit_hook:19.Lfunc_begin0:20.Lfunc_gep0:21 addis 2, 12, .TOC.-.Lfunc_gep0@ha22 addi 2, 2, .TOC.-.Lfunc_gep0@l23.Lfunc_lep0:24 .localentry on_exit_hook, .Lfunc_lep0-.Lfunc_gep025 mflr 026 stdu 1, -32(1)27 std 0, 48(1)28 li 3, 029 bl llvm_jitlink_setTestResultOverride30 nop31 addi 1, 1, 3232 ld 0, 16(1)33 mtlr 034 blr35 .long 036 .quad 037.Lfunc_end0:38 .size on_exit_hook, .Lfunc_end0-.Lfunc_begin039 40// main registers the atexit and sets the test result to one.41 .globl main42 .p2align 443 .type main,@function44main:45.Lfunc_begin1:46.Lfunc_gep1:47 addis 2, 12, .TOC.-.Lfunc_gep1@ha48 addi 2, 2, .TOC.-.Lfunc_gep1@l49.Lfunc_lep1:50 .localentry main, .Lfunc_lep1-.Lfunc_gep151 mflr 052 stdu 1, -32(1)53 std 0, 48(1)54 addis 3, 2, on_exit_hook@toc@ha55 addi 3, 3, on_exit_hook@toc@l56 bl atexit57 nop58 li 3, 159 bl llvm_jitlink_setTestResultOverride60 nop61 li 3, 062 addi 1, 1, 3263 ld 0, 16(1)64 mtlr 065 blr66 .long 067 .quad 068.Lfunc_end1:69 .size main, .Lfunc_end1-.Lfunc_begin170