xref: /netbsd-src/external/gpl3/gcc.old/dist/libgcc/config/sol2/crtpg.c (revision 8feb0f0b7eaff0608f8350bbfa3098827b4bb91b)
136ac495dSmrg /* Register profiling startup and cleanup with Solaris CRTs.
2*8feb0f0bSmrg    Copyright (C) 2015-2020 Free Software Foundation, Inc.
336ac495dSmrg 
436ac495dSmrg This file is part of GCC.
536ac495dSmrg 
636ac495dSmrg GCC is free software; you can redistribute it and/or modify it under
736ac495dSmrg the terms of the GNU General Public License as published by the Free
836ac495dSmrg Software Foundation; either version 3, or (at your option) any later
936ac495dSmrg version.
1036ac495dSmrg 
1136ac495dSmrg GCC is distributed in the hope that it will be useful, but WITHOUT ANY
1236ac495dSmrg WARRANTY; without even the implied warranty of MERCHANTABILITY or
1336ac495dSmrg FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1436ac495dSmrg for more details.
1536ac495dSmrg 
1636ac495dSmrg Under Section 7 of GPL version 3, you are granted additional
1736ac495dSmrg permissions described in the GCC Runtime Library Exception, version
1836ac495dSmrg 3.1, as published by the Free Software Foundation.
1936ac495dSmrg 
2036ac495dSmrg You should have received a copy of the GNU General Public License and
2136ac495dSmrg a copy of the GCC Runtime Library Exception along with this program;
2236ac495dSmrg see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
2336ac495dSmrg <http://www.gnu.org/licenses/>.  */
2436ac495dSmrg 
2536ac495dSmrg #include <stdlib.h>
2636ac495dSmrg 
2736ac495dSmrg extern void monstartup (char *, char *);
2836ac495dSmrg extern void _mcleanup (void);
2936ac495dSmrg 
3036ac495dSmrg extern char _start[], _etext[];
3136ac495dSmrg 
3236ac495dSmrg int __start_crt_compiler (int, char **);
3336ac495dSmrg 
3436ac495dSmrg /* Since Solaris 11.4, the system-provided CRTs provide a hook to invoke
3536ac495dSmrg    initialization code early during process startup.  __start_crt_compiler
3636ac495dSmrg    is documented in crt1.o(5).  We use it to perform initialization for
3736ac495dSmrg    profiling as a substitute for the earlier separate gcrt1.o.  */
3836ac495dSmrg 
3936ac495dSmrg int
__start_crt_compiler(int argc,char ** argv)4036ac495dSmrg __start_crt_compiler (int argc __attribute__ ((unused)),
4136ac495dSmrg 		      char **argv __attribute__ ((unused)))
4236ac495dSmrg {
4336ac495dSmrg   monstartup (_start, _etext);
4436ac495dSmrg   atexit (_mcleanup);
4536ac495dSmrg   return 0;
4636ac495dSmrg }
47