OSDN Git Service

* config/alpha/xm-vms.h (_POSIX_EXIT): Define.
[pf3gnuchains/gcc-fork.git] / gcc / config / m68k / aux-mcount.c
1 /* Profiling support code for A/UX 
2    Copyright (C) 1996 Free Software Foundation, Inc.
3
4 This file is free software; you can redistribute it and/or modify it
5 under the terms of the GNU General Public License as published by the
6 Free Software Foundation; either version 2, or (at your option) any
7 later version.
8
9 In addition to the permissions in the GNU General Public License, the
10 Free Software Foundation gives you unlimited permission to link the
11 compiled version of this file into combinations with other programs,
12 and to distribute those combinations without any restriction coming
13 from the use of this file.  (The General Public License restrictions
14 do apply in other respects; for example, they cover modification of
15 the file, and distribution when not linked into a combine
16 executable.)
17
18 This file is distributed in the hope that it will be useful, but
19 WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21 General Public License for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with this program; see the file COPYING.  If not, write to
25 the Free Software Foundation, 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA.  */
27
28 /* This routine is called at the beginning of functions compiled with -p
29    or -pg.  The A/UX libraries call mcount%, but gas cannot generate 
30    symbols with embedded percent signs.  Previous ports of GCC to A/UX 
31    have done things like (1) assemble a stub routine with the native
32    assembler, or (2) assemble a stub routine with gas and edit the object
33    file.  This solution has the advantage that it can interoperate with
34    the A/UX version and can be used in an eventual port of glibc to A/UX.  */
35
36 #ifndef __GNUC__
37 #error This file uses GNU C extensions
38 #endif
39
40 #include "tconfig.h"
41 #include <mon.h>
42
43 struct cnt *_countbase;
44
45 #ifdef FUNCTION_PROFILER_SYMBOL
46 void __mcount() __asm__(FUNCTION_PROFILER_SYMBOL);
47 #endif
48
49 void __mcount()
50 {
51   register long **pfncnt __asm__("%a0");
52   register long *fncnt = *pfncnt;
53
54   if (!fncnt)
55     {
56       struct cnt *newcnt = _countbase++;
57       newcnt->fnpc = (char *)__builtin_return_address(0);
58       *pfncnt = fncnt = &newcnt->mcnt;
59     }
60   *fncnt += 1;
61 }