]>
sourceware.org Git - glibc.git/blob - csu/gmon-start.c
1 /* Code to enable profiling at program startup.
2 Copyright (C) 1995,1996,1997,2000,2001,2002,2012 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library 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 GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 #include <sys/types.h>
27 /* Beginning and end of our code segment. We cannot declare them
28 as the external functions since we want the addresses of those
29 labels. Taking the address of a function may have different
30 meanings on different platforms. */
31 #ifdef ENTRY_POINT_DECL
32 ENTRY_POINT_DECL(extern)
34 extern char ENTRY_POINT
[];
39 # ifdef ENTRY_POINT_DECL
40 # define TEXT_START ENTRY_POINT
42 # define TEXT_START &ENTRY_POINT
46 /* We cannot use the normal constructor mechanism to call
47 __gmon_start__ because gcrt1.o appears before crtbegin.o in the link.
48 Instead crti.o calls it specially. */
49 extern void __gmon_start__ (void);
54 /* Protect from being called more than once. Since crti.o is linked
55 into every shared library, each of their init functions will call us. */
63 /* Start keeping profiling records. */
64 __monstartup ((u_long
) TEXT_START
, (u_long
) &etext
);
66 /* Call _mcleanup before exiting; it will write out gmon.out from the
This page took 0.043617 seconds and 6 git commands to generate.