brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.1 KiB · 338a8f9 Raw
71 lines · plain
1#===------------------------------------------------------------------------===#2#3# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4# See https://llvm.org/LICENSE.txt for license information.5# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6#7#===------------------------------------------------------------------------===#8 9# REQUIRES: target={{x86_64-.+}}10# UNSUPPORTED: target={{.*-windows.*}}11 12# Inline assembly isn't supported by Memory Sanitizer13# UNSUPPORTED: msan14 15# RUN: %{build} -no-pie16# RUN: %{run}17 18# The following assembly is a translation of this code:19#20#   _Unwind_Reason_Code callback(int, _Unwind_Action, long unsigned int,21#                                _Unwind_Exception*, _Unwind_Context*, void*) {22#     return _Unwind_Reason_Code(0);23#   }24#25#   int main() {26#     asm(".cfi_remember_state\n\t");27#     _Unwind_Exception exc;28#     _Unwind_ForcedUnwind(&exc, callback, 0);29#     asm(".cfi_restore_state\n\t");30#   }31#32# When unwinding, the CFI parser will stop parsing opcodes after the current PC,33# so in this case the DW_CFA_restore_state opcode will never be processed and,34# if the library doesn't clean up properly, the store allocated by35# DW_CFA_remember_state will be leaked.36#37# This test will fail when linked with an asan-enabled libunwind if the38# remembered state is leaked.39 40    SIZEOF_UNWIND_EXCEPTION = 3241 42    .att_syntax43    .text44callback:45    xorl    %eax, %eax46    retq47 48    .globl    main                    # -- Begin function main49    .p2align    4, 0x9050    .type    main,@function51main:                                   # @main52    .cfi_startproc53    subq    $8, %rsp   # Adjust stack alignment54    subq    $SIZEOF_UNWIND_EXCEPTION, %rsp55    .cfi_def_cfa_offset 4856    .cfi_remember_state57    movq    %rsp, %rdi58    movabsq $callback, %rsi59    xorl    %edx, %edx60    callq    _Unwind_ForcedUnwind61    .cfi_restore_state62    xorl    %eax, %eax63    addq    $SIZEOF_UNWIND_EXCEPTION, %rsp64    addq    $8, %rsp   # Undo stack alignment adjustment65    .cfi_def_cfa_offset 866    retq67.Lfunc_end1:68    .size    main, .Lfunc_end1-main69    .cfi_endproc70                                        # -- End function71