crtpg.c revision 1.1.1.8 1 1.1 mrg /* Register profiling startup and cleanup with Solaris CRTs.
2 1.1.1.8 mrg Copyright (C) 2015-2019 Free Software Foundation, Inc.
3 1.1 mrg
4 1.1 mrg This file is part of GCC.
5 1.1 mrg
6 1.1 mrg GCC is free software; you can redistribute it and/or modify it under
7 1.1 mrg the terms of the GNU General Public License as published by the Free
8 1.1 mrg Software Foundation; either version 3, or (at your option) any later
9 1.1 mrg version.
10 1.1 mrg
11 1.1 mrg GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 1.1 mrg WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 1.1 mrg FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 1.1 mrg for more details.
15 1.1 mrg
16 1.1 mrg Under Section 7 of GPL version 3, you are granted additional
17 1.1 mrg permissions described in the GCC Runtime Library Exception, version
18 1.1 mrg 3.1, as published by the Free Software Foundation.
19 1.1 mrg
20 1.1 mrg You should have received a copy of the GNU General Public License and
21 1.1 mrg a copy of the GCC Runtime Library Exception along with this program;
22 1.1 mrg see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23 1.1 mrg <http://www.gnu.org/licenses/>. */
24 1.1 mrg
25 1.1 mrg #include <stdlib.h>
26 1.1 mrg
27 1.1 mrg extern void monstartup (char *, char *);
28 1.1 mrg extern void _mcleanup (void);
29 1.1 mrg
30 1.1 mrg extern char _start[], _etext[];
31 1.1 mrg
32 1.1 mrg int __start_crt_compiler (int, char **);
33 1.1 mrg
34 1.1.1.3 mrg /* Since Solaris 11.4, the system-provided CRTs provide a hook to invoke
35 1.1.1.3 mrg initialization code early during process startup. __start_crt_compiler
36 1.1.1.3 mrg is documented in crt1.o(5). We use it to perform initialization for
37 1.1.1.3 mrg profiling as a substitute for the earlier separate gcrt1.o. */
38 1.1 mrg
39 1.1 mrg int
40 1.1 mrg __start_crt_compiler (int argc __attribute__ ((unused)),
41 1.1 mrg char **argv __attribute__ ((unused)))
42 1.1 mrg {
43 1.1 mrg monstartup (_start, _etext);
44 1.1 mrg atexit (_mcleanup);
45 1.1 mrg return 0;
46 1.1 mrg }
47