39 lines · plain
1// Test that the runtime correctly interposes ___cxa_atexit.2//3// RUN: %clang -c -o %t %s4// RUN: %llvm_jitlink %t5 6 .section __TEXT,__text,regular,pure_instructions7 .build_version macos, 11, 0 sdk_version 11, 38 9// OnExit destructor resets the test result override to zero.10 .globl __ZN6OnExitD1Ev11 .weak_def_can_be_hidden __ZN6OnExitD1Ev12 .p2align 4, 0x9013__ZN6OnExitD1Ev:14 xorl %edi, %edi15 jmp _llvm_jitlink_setTestResultOverride16 17// main registers the atexit and sets the test result to one.18 .globl _main19 .p2align 4, 0x9020_main:21 pushq %rbp22 movq %rsp, %rbp23 24 movq __ZN6OnExitD1Ev@GOTPCREL(%rip), %rdi25 leaq _onExit(%rip), %rsi26 leaq ___dso_handle(%rip), %rdx27 callq ___cxa_atexit28 29 movl $1, %edi30 callq _llvm_jitlink_setTestResultOverride31 xorl %eax, %eax32 popq %rbp33 retq34 35 .globl _onExit36.zerofill __DATA,__common,_onExit,1,037 38.subsections_via_symbols39