1/*
2   Copyright 2009-2020 Free Software Foundation, Inc.
3
4   This program is free software; you can redistribute it and/or modify
5   it under the terms of the GNU General Public License as published by
6   the Free Software Foundation; either version 3 of the License, or
7   (at your option) any later version.
8
9   This program is distributed in the hope that it will be useful,
10   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   GNU General Public License for more details.
13
14   You should have received a copy of the GNU General Public License
15   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
16
17/* Compile with "gcc -nostdlib dw2-restore.S" */
18
19	.text
20	.globl _start
21	.func	_start
22_start:	call foo
23	mov $0,%rax
24	ret
25	.endfunc
26
27	.func	foo
28foo:	.cfi_startproc
29	push %rbp
30	.cfi_adjust_cfa_offset 8
31	mov %rsp,%rbp
32	.cfi_def_cfa_register %rbp
33
34	.cfi_remember_state
35	jmp 2f
36
371:	mov %rbp,%rsp
38	.cfi_restore %rbp
39	pop %rbp
40	.cfi_adjust_cfa_offset -8
41	.cfi_def_cfa_register %rsp
42	ret
43
44	.cfi_restore_state
452: 	movq $0,%rax
46	movq $0,(%rax)  /* crash here */
47	jmp 1b
48	.cfi_endproc
49	.endfunc
50