dw2-skip-prologue.c revision 1.9
1/* This testcase is part of GDB, the GNU debugger.
2
3   Copyright 2011-2020 Free Software Foundation, Inc.
4
5   This program is free software; you can redistribute it and/or modify
6   it under the terms of the GNU General Public License as published by
7   the Free Software Foundation; either version 3 of the License, or
8   (at your option) any later version.
9
10   This program is distributed in the hope that it will be useful,
11   but WITHOUT ANY WARRANTY; without even the implied warranty of
12   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   GNU General Public License for more details.
14
15   You should have received a copy of the GNU General Public License
16   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
17
18static volatile int v;
19
20asm ("func_start: .globl func_start\n");
21static int
22func (void)
23{
24  v++;
25asm ("func0: .globl func0\n");
26  v++;
27asm ("func1: .globl func1\n");
28  v++;
29asm ("func2: .globl func2\n");
30  v++;
31asm ("func3: .globl func3\n");
32  return v;
33}
34asm ("func_end: .globl func_end\n");
35
36/* Equivalent copy but renamed s/func/fund/.  */
37
38asm ("fund_start: .globl fund_start\n");
39static int
40fund (void)
41{
42  v++;
43asm ("fund0: .globl fund0\n");
44  v++;
45asm ("fund1: .globl fund1\n");
46  v++;
47asm ("fund2: .globl fund2\n");
48  v++;
49asm ("fund3: .globl fund3\n");
50  return v;
51}
52asm ("fund_end: .globl fund_end\n");
53
54int
55main (void)
56{
57  return func () + fund ();
58}
59