diff options
author | Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> | 2015-09-24 08:51:39 +0000 |
---|---|---|
committer | Rainer Orth <ro@gcc.gnu.org> | 2015-09-24 08:51:39 +0000 |
commit | 2d11044217edd9168eafea1c8c60603f87b0e00d (patch) | |
tree | 025e93ec3292313d548bc0002efbee95ff405726 /libgcc/config | |
parent | fcb901cdfac9321b0202d800621f06b2aafd5bee (diff) | |
download | gcc-2d11044217edd9168eafea1c8c60603f87b0e00d.zip gcc-2d11044217edd9168eafea1c8c60603f87b0e00d.tar.gz gcc-2d11044217edd9168eafea1c8c60603f87b0e00d.tar.bz2 |
Use CRTs provided by Solaris
gcc:
* configure.ac (gcc_cv_solaris_crts): New test.
* configure. Regenerate.
* config.in: Regenerate.
* config/sol2.h (STARTFILE_SPEC): Simplify, provide
HAVE_SOLARIS_CRTS variant.
libgcc:
* configure.ac (libgcc_cv_solaris_crts): New test.
* configure: Regenerate.
* config.in: Regenerate.
* config/sol2/crtp.c, config/sol2/crtpg.c: New files.
* config/gmon-sol2.c: Rename to ...
* config/sol2/gmon.c: ... this.
Include auto-target.h.
(internal_mcount): Wrap setup handling in !HAVE_SOLARIS_CRTS.
* config/t-sol2: Rename to ...
* config/sol2/t-sol2: ... this.
(gmon.o): Reflect renaming.
(crtp.o, crtpg.o): New rules.
* config.host (*-*-solaris2*): Reflect renaming.
Use system CRTs if present.
Remove default CRT case.
From-SVN: r228077
Diffstat (limited to 'libgcc/config')
-rw-r--r-- | libgcc/config/sol2/crtp.c | 33 | ||||
-rw-r--r-- | libgcc/config/sol2/crtpg.c | 47 | ||||
-rw-r--r-- | libgcc/config/sol2/gmon.c (renamed from libgcc/config/gmon-sol2.c) | 7 | ||||
-rw-r--r-- | libgcc/config/sol2/t-sol2 (renamed from libgcc/config/t-sol2) | 10 |
4 files changed, 95 insertions, 2 deletions
diff --git a/libgcc/config/sol2/crtp.c b/libgcc/config/sol2/crtp.c new file mode 100644 index 0000000..8b79c55e --- /dev/null +++ b/libgcc/config/sol2/crtp.c @@ -0,0 +1,33 @@ +/* Dummy _mcount when mixing profiling and non-profiling objects. + Copyright (C) 2015 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +<http://www.gnu.org/licenses/>. */ + +void _mcount (void); + +/* A dummy profiling support routine for non-profiling executables, + in case we link in some objects that have been compiled for profiling. */ + +void __attribute__((weak)) +_mcount (void) +{ +} diff --git a/libgcc/config/sol2/crtpg.c b/libgcc/config/sol2/crtpg.c new file mode 100644 index 0000000..e07a36a --- /dev/null +++ b/libgcc/config/sol2/crtpg.c @@ -0,0 +1,47 @@ +/* Register profiling startup and cleanup with Solaris CRTs. + Copyright (C) 2015 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +<http://www.gnu.org/licenses/>. */ + +#include <stdlib.h> + +extern void monstartup (char *, char *); +extern void _mcleanup (void); + +extern char _start[], _etext[]; + +int __start_crt_compiler (int, char **); + +/* Since Solaris 11.x and Solaris 12, the system-provided CRTs provide a + hook to invoke initialization code early during process startup. + __start_crt_compiler is documented in crt1.o(5). We use it to perform + initialization for profiling as a substitute for the earlier separate + gcrt1.o. */ + +int +__start_crt_compiler (int argc __attribute__ ((unused)), + char **argv __attribute__ ((unused))) +{ + monstartup (_start, _etext); + atexit (_mcleanup); + return 0; +} diff --git a/libgcc/config/gmon-sol2.c b/libgcc/config/sol2/gmon.c index 7d61496..f641958 100644 --- a/libgcc/config/gmon-sol2.c +++ b/libgcc/config/sol2/gmon.c @@ -39,6 +39,7 @@ #include "tconfig.h" #include "tsystem.h" +#include "auto-target.h" #include <fcntl.h> /* For creat. */ extern void monstartup (char *, char *); @@ -324,6 +325,11 @@ internal_mcount (char *selfpc, unsigned short *frompcindex) frompcindex = (void *) __builtin_return_address (1); #endif +/* Only necessary without the Solaris CRTs or a proper gcrt1.o, otherwise + crtpg.o or gcrt1.o take care of that. + + FIXME: What about _init vs. _start on sparc? */ +#ifndef HAVE_SOLARIS_CRTS if(!already_setup) { extern char etext[]; @@ -344,6 +350,7 @@ internal_mcount (char *selfpc, unsigned short *frompcindex) #endif atexit (_mcleanup); } +#endif /* !HAVE_SOLARIS_CRTS */ /* Check that we are profiling and that we aren't recursively invoked. */ if (profiling) { goto out; diff --git a/libgcc/config/t-sol2 b/libgcc/config/sol2/t-sol2 index 85eddb2..1f7324a 100644 --- a/libgcc/config/t-sol2 +++ b/libgcc/config/sol2/t-sol2 @@ -16,8 +16,14 @@ # along with GCC; see the file COPYING3. If not see # <http://www.gnu.org/licenses/>. -# gmon build rule: -gmon.o: $(srcdir)/config/gmon-sol2.c +# crtp, crtpg build rules +crtp.o: $(srcdir)/config/sol2/crtp.c + $(gcc_compile) -c $< +crtpg.o: $(srcdir)/config/sol2/crtpg.c + $(gcc_compile) -c $< + +# gmon build rule +gmon.o: $(srcdir)/config/sol2/gmon.c $(gcc_compile) -c $< # Assemble startup files. |