| 1 |
// Test that the runtime correctly interposes ___cxa_atexit. |
| 2 |
// |
| 3 |
// RUN: %clang -c -o %t %s |
| 4 |
// RUN: %llvm_jitlink %t |
| 5 |
|
| 6 |
.text |
| 7 |
// OnExit destructor resets the test result override to zero. |
| 8 |
.section .text._ZN6OnExitD2Ev,"axG",@progbits,_ZN6OnExitD2Ev,comdat |
| 9 |
.p2align 4, 0x90 |
| 10 |
.type _ZN6OnExitD2Ev,@function |
| 11 |
_ZN6OnExitD2Ev: # @_ZN6OnExitD2Ev |
| 12 |
.cfi_startproc |
| 13 |
xorl %edi, %edi |
| 14 |
jmp llvm_jitlink_setTestResultOverride@PLT # TAILCALL |
| 15 |
.cfi_endproc |
| 16 |
|
| 17 |
// main registers the atexit and sets the test result to one. |
| 18 |
.globl main |
| 19 |
.p2align 4, 0x90 # -- Begin function main |
| 20 |
.type main,@function |
| 21 |
main: # @main |
| 22 |
.cfi_startproc |
| 23 |
# %bb.0: |
| 24 |
movq _ZN6OnExitD2Ev@GOTPCREL(%rip), %rdi |
| 25 |
leaq _ZL6onExit(%rip), %rsi |
| 26 |
leaq __dso_handle(%rip), %rdx |
| 27 |
callq __cxa_atexit@PLT |
| 28 |
movl $1, %edi |
| 29 |
callq llvm_jitlink_setTestResultOverride@PLT |
| 30 |
xorl %eax, %eax |
| 31 |
retq |
| 32 |
.Lfunc_end1: |
| 33 |
.size main, .Lfunc_end1-main |
| 34 |
.cfi_endproc |
| 35 |
# -- End function |
| 36 |
.type _ZL6onExit,@object # @_ZL6onExit |
| 37 |
.local _ZL6onExit |
| 38 |
.comm _ZL6onExit,1,1 |
| 39 |
.hidden __dso_handle |