[RISCV][VLOPT] Add vector narrowing integer right shift instructions to isSupportedIn...
[llvm-project.git] / libunwind / test / remember_state_leak.pass.sh.s
blob63beb7e4701ec0b7c5f093b23f45f22a828174a0
1 #===------------------------------------------------------------------------===#
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-exception
7 #===------------------------------------------------------------------------===#
9 # REQUIRES: target={{x86_64-.+-linux-gnu}}
11 # Inline assembly isn't supported by Memory Sanitizer
12 # UNSUPPORTED: msan
14 # RUN: %{build} -no-pie
15 # RUN: %{run}
17 # The following assembly is a translation of this code:
19 # _Unwind_Reason_Code callback(int, _Unwind_Action, long unsigned int,
20 # _Unwind_Exception*, _Unwind_Context*, void*) {
21 # return _Unwind_Reason_Code(0);
22 # }
24 # int main() {
25 # asm(".cfi_remember_state\n\t");
26 # _Unwind_Exception exc;
27 # _Unwind_ForcedUnwind(&exc, callback, 0);
28 # asm(".cfi_restore_state\n\t");
29 # }
31 # When unwinding, the CFI parser will stop parsing opcodes after the current PC,
32 # so in this case the DW_CFA_restore_state opcode will never be processed and,
33 # if the library doesn't clean up properly, the store allocated by
34 # DW_CFA_remember_state will be leaked.
36 # This test will fail when linked with an asan-enabled libunwind if the
37 # remembered state is leaked.
39 SIZEOF_UNWIND_EXCEPTION = 32
41 .text
42 callback:
43 xorl %eax, %eax
44 retq
46 .globl main # -- Begin function main
47 .p2align 4, 0x90
48 .type main,@function
49 main: # @main
50 .cfi_startproc
51 subq $8, %rsp # Adjust stack alignment
52 subq $SIZEOF_UNWIND_EXCEPTION, %rsp
53 .cfi_def_cfa_offset 48
54 .cfi_remember_state
55 movq %rsp, %rdi
56 movabsq $callback, %rsi
57 xorl %edx, %edx
58 callq _Unwind_ForcedUnwind
59 .cfi_restore_state
60 xorl %eax, %eax
61 addq $SIZEOF_UNWIND_EXCEPTION, %rsp
62 addq $8, %rsp # Undo stack alignment adjustment
63 .cfi_def_cfa_offset 8
64 retq
65 .Lfunc_end1:
66 .size main, .Lfunc_end1-main
67 .cfi_endproc
68 # -- End function