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
This commit is contained in:
parent
fcb901cdfa
commit
2d11044217
@ -1,3 +1,11 @@
|
||||
2015-09-24 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
|
||||
|
||||
* configure.ac (gcc_cv_solaris_crts): New test.
|
||||
* configure. Regenerate.
|
||||
* config.in: Regenerate.
|
||||
* config/sol2.h (STARTFILE_SPEC): Simplify, provide
|
||||
HAVE_SOLARIS_CRTS variant.
|
||||
|
||||
2015-09-24 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
|
||||
|
||||
* tree-inline.h (count_insns_seq): Delete prototype.
|
||||
|
@ -1631,6 +1631,12 @@
|
||||
#endif
|
||||
|
||||
|
||||
/* Define if the system-provided CRTs are present on Solaris. */
|
||||
#ifndef USED_FOR_TARGET
|
||||
#undef HAVE_SOLARIS_CRTS
|
||||
#endif
|
||||
|
||||
|
||||
/* Define to 1 if you have the <stddef.h> header file. */
|
||||
#ifndef USED_FOR_TARGET
|
||||
#undef HAVE_STDDEF_H
|
||||
|
@ -156,14 +156,24 @@ along with GCC; see the file COPYING3. If not see
|
||||
|
||||
/* We don't use the standard svr4 STARTFILE_SPEC because it's wrong for us. */
|
||||
#undef STARTFILE_SPEC
|
||||
#define STARTFILE_SPEC "%{!shared: \
|
||||
%{!symbolic: \
|
||||
%{p:mcrt1.o%s} \
|
||||
%{!p: \
|
||||
%{pg:gcrt1.o%s gmon.o%s} \
|
||||
%{!pg:crt1.o%s}}}} \
|
||||
#ifdef HAVE_SOLARIS_CRTS
|
||||
/* Since Solaris 11.x and Solaris 12, the OS delivers crt1.o, crti.o, and
|
||||
crtn.o, with a hook for compiler-dependent stuff like profile handling. */
|
||||
#define STARTFILE_SPEC "%{!shared:%{!symbolic: \
|
||||
crt1.o%s \
|
||||
%{p:%e-p is not supported; \
|
||||
pg:crtpg.o%s gmon.o%s; \
|
||||
:crtp.o%s}}} \
|
||||
crti.o%s %(startfile_arch) \
|
||||
crtbegin.o%s"
|
||||
#else
|
||||
#define STARTFILE_SPEC "%{!shared:%{!symbolic: \
|
||||
%{p:mcrt1.o%s; \
|
||||
pg:gcrt1.o%s gmon.o%s; \
|
||||
:crt1.o%s}}} \
|
||||
crti.o%s %(startfile_arch) \
|
||||
crtbegin.o%s"
|
||||
#endif
|
||||
|
||||
#undef ENDFILE_SPEC
|
||||
#define ENDFILE_SPEC \
|
||||
|
38
gcc/configure
vendored
38
gcc/configure
vendored
@ -28025,6 +28025,44 @@ $as_echo "#define HAVE_LD_SYSROOT 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
case $target in
|
||||
*-*-solaris2*)
|
||||
# Check for system-provided CRTs on Solaris 11.x and Solaris 12.
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking system-provided CRTs on Solaris" >&5
|
||||
$as_echo_n "checking system-provided CRTs on Solaris... " >&6; }
|
||||
if test "${gcc_cv_solaris_crts+set}" = set; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
gcc_cv_solaris_crts=no
|
||||
if test x$host != x$target; then
|
||||
if test "x$with_sysroot" = xyes; then
|
||||
target_sysroot="${test_exec_prefix}/${target_noncanonical}/sys-root"
|
||||
else
|
||||
target_sysroot="${with_sysroot}"
|
||||
fi
|
||||
fi
|
||||
target_libdir="$target_sysroot/usr/lib"
|
||||
# At the time they were added, gcrt1.o became a symlink for backwards
|
||||
# compatibility on x86, while crt1.o was added on sparc, so check for that.
|
||||
case $target in
|
||||
i?86-*-solaris2* | x86_64-*-solaris2*)
|
||||
if test -h "$target_libdir/gcrt1.o"; then gcc_cv_solaris_crts=yes; fi
|
||||
;;
|
||||
sparc*-*-solaris2*)
|
||||
if test -f "$target_libdir/crt1.o"; then gcc_cv_solaris_crts=yes; fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_solaris_crts" >&5
|
||||
$as_echo "$gcc_cv_solaris_crts" >&6; }
|
||||
;;
|
||||
esac
|
||||
if test x$gcc_cv_solaris_crts = xyes; then
|
||||
|
||||
$as_echo "#define HAVE_SOLARIS_CRTS 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
# Test for stack protector support in target C library.
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking __stack_chk_fail in target C library" >&5
|
||||
$as_echo_n "checking __stack_chk_fail in target C library... " >&6; }
|
||||
|
@ -5281,6 +5281,37 @@ if test x"$gcc_cv_ld_sysroot" = xyes; then
|
||||
[Define if your linker supports --sysroot.])
|
||||
fi
|
||||
|
||||
case $target in
|
||||
*-*-solaris2*)
|
||||
# Check for system-provided CRTs on Solaris 11.x and Solaris 12.
|
||||
AC_CACHE_CHECK([system-provided CRTs on Solaris],
|
||||
gcc_cv_solaris_crts,
|
||||
[gcc_cv_solaris_crts=no
|
||||
if test x$host != x$target; then
|
||||
if test "x$with_sysroot" = xyes; then
|
||||
target_sysroot="${test_exec_prefix}/${target_noncanonical}/sys-root"
|
||||
else
|
||||
target_sysroot="${with_sysroot}"
|
||||
fi
|
||||
fi
|
||||
target_libdir="$target_sysroot/usr/lib"
|
||||
# At the time they were added, gcrt1.o became a symlink for backwards
|
||||
# compatibility on x86, while crt1.o was added on sparc, so check for that.
|
||||
case $target in
|
||||
i?86-*-solaris2* | x86_64-*-solaris2*)
|
||||
if test -h "$target_libdir/gcrt1.o"; then gcc_cv_solaris_crts=yes; fi
|
||||
;;
|
||||
sparc*-*-solaris2*)
|
||||
if test -f "$target_libdir/crt1.o"; then gcc_cv_solaris_crts=yes; fi
|
||||
;;
|
||||
esac])
|
||||
;;
|
||||
esac
|
||||
if test x$gcc_cv_solaris_crts = xyes; then
|
||||
AC_DEFINE(HAVE_SOLARIS_CRTS, 1,
|
||||
[Define if the system-provided CRTs are present on Solaris.])
|
||||
fi
|
||||
|
||||
# Test for stack protector support in target C library.
|
||||
AC_CACHE_CHECK(__stack_chk_fail in target C library,
|
||||
gcc_cv_libc_provides_ssp,
|
||||
|
@ -1,3 +1,21 @@
|
||||
2015-09-24 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
|
||||
|
||||
* 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.
|
||||
|
||||
2015-09-23 John David Anglin <danglin@gcc.gnu.org>
|
||||
|
||||
* config/pa/linux-atomic.c (__kernel_cmpxchg2): Reorder error checks.
|
||||
|
@ -267,7 +267,7 @@ case ${host} in
|
||||
*-*-solaris2*)
|
||||
# Unless linker support and dl_iterate_phdr are present,
|
||||
# unwind-dw2-fde-dip.c automatically falls back to unwind-dw2-fde.c.
|
||||
tmake_file="$tmake_file t-sol2 t-eh-dw2-dip t-libgcc-pic t-slibgcc t-slibgcc-elf-ver"
|
||||
tmake_file="$tmake_file sol2/t-sol2 t-eh-dw2-dip t-libgcc-pic t-slibgcc t-slibgcc-elf-ver"
|
||||
if test $with_gnu_ld = yes; then
|
||||
tmake_file="$tmake_file t-slibgcc-gld"
|
||||
else
|
||||
@ -276,19 +276,22 @@ case ${host} in
|
||||
# Add cpu-specific t-sol2 after t-slibgcc-* so it can augment SHLIB_MAPFILES.
|
||||
tmake_file="$tmake_file $cpu_type/t-sol2"
|
||||
extra_parts="gmon.o crtbegin.o crtend.o"
|
||||
case ${host} in
|
||||
i?86-*-solaris2.1[0-9]* | x86_64-*-solaris2.1[0-9]*)
|
||||
# Solaris 10+/x86 provides crt1.o, crti.o, crtn.o, and gcrt1.o as
|
||||
# part of the base system.
|
||||
;;
|
||||
sparc*-*-solaris2.1[0-9]*)
|
||||
# Solaris 10+/SPARC lacks crt1.o and gcrt1.o.
|
||||
extra_parts="$extra_parts crt1.o gcrt1.o"
|
||||
;;
|
||||
*)
|
||||
extra_parts="$extra_parts crt1.o crti.o crtn.o gcrt1.o"
|
||||
;;
|
||||
esac
|
||||
if test "${libgcc_cv_solaris_crts}" = yes; then
|
||||
# Solaris 11.x and 12 provide crt1.o, crti.o, and crtn.o as part of the
|
||||
# base system. crtp.o and crtpg.o implement the compiler-dependent parts.
|
||||
extra_parts="$extra_parts crtp.o crtpg.o"
|
||||
else
|
||||
case ${host} in
|
||||
i?86-*-solaris2.1[0-9]* | x86_64-*-solaris2.1[0-9]*)
|
||||
# Solaris 10+/x86 provides crt1.o, crti.o, crtn.o, and gcrt1.o as
|
||||
# part of the base system.
|
||||
;;
|
||||
sparc*-*-solaris2.1[0-9]*)
|
||||
# Solaris 10+/SPARC lacks crt1.o and gcrt1.o.
|
||||
extra_parts="$extra_parts crt1.o gcrt1.o"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
*-*-uclinux*)
|
||||
extra_parts="crtbegin.o crtend.o"
|
||||
|
@ -18,6 +18,9 @@
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define if the system-provided CRTs are present on Solaris. */
|
||||
#undef HAVE_SOLARIS_CRTS
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
|
33
libgcc/config/sol2/crtp.c
Normal file
33
libgcc/config/sol2/crtp.c
Normal file
@ -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)
|
||||
{
|
||||
}
|
47
libgcc/config/sol2/crtpg.c
Normal file
47
libgcc/config/sol2/crtpg.c
Normal file
@ -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;
|
||||
}
|
@ -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;
|
@ -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.
|
32
libgcc/configure
vendored
32
libgcc/configure
vendored
@ -4665,6 +4665,38 @@ fi
|
||||
$as_echo "$libgcc_cv_mips_hard_float" >&6; }
|
||||
esac
|
||||
|
||||
case ${host} in
|
||||
*-*-solaris2*)
|
||||
# Check for system-provided CRTs on Solaris 11.x and Solaris 12.
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking system-provided CRTs on Solaris" >&5
|
||||
$as_echo_n "checking system-provided CRTs on Solaris... " >&6; }
|
||||
if test "${libgcc_cv_solaris_crts+set}" = set; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
libgcc_cv_solaris_crts=no
|
||||
libgcc_sysroot="`${CC} -print-sysroot`"
|
||||
libgcc_libdir="$libgcc_sysroot/usr/lib"
|
||||
# At the time they were added, gcrt1.o became a symlink for backwards
|
||||
# compatibility on x86, while crt1.o was added on sparc, so check for that.
|
||||
case ${host} in
|
||||
i?86-*-solaris2* | x86_64-*-solaris2*)
|
||||
if test -h "$libgcc_libdir/gcrt1.o"; then libgcc_cv_solaris_crts=yes; fi
|
||||
;;
|
||||
sparc*-*-solaris2*)
|
||||
if test -f "$libgcc_libdir/crt1.o"; then libgcc_cv_solaris_crts=yes; fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgcc_cv_solaris_crts" >&5
|
||||
$as_echo "$libgcc_cv_solaris_crts" >&6; }
|
||||
if test $libgcc_cv_solaris_crts = yes; then
|
||||
|
||||
$as_echo "#define HAVE_SOLARIS_CRTS 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# Determine the version of glibc, if any, used on the target.
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for target glibc version" >&5
|
||||
$as_echo_n "checking for target glibc version... " >&6; }
|
||||
|
@ -292,6 +292,31 @@ mips*-*-*)
|
||||
[libgcc_cv_mips_hard_float=no])])
|
||||
esac
|
||||
|
||||
case ${host} in
|
||||
*-*-solaris2*)
|
||||
# Check for system-provided CRTs on Solaris 11.x and Solaris 12.
|
||||
AC_CACHE_CHECK([system-provided CRTs on Solaris],
|
||||
[libgcc_cv_solaris_crts],
|
||||
[libgcc_cv_solaris_crts=no
|
||||
libgcc_sysroot="`${CC} -print-sysroot`"
|
||||
libgcc_libdir="$libgcc_sysroot/usr/lib"
|
||||
# At the time they were added, gcrt1.o became a symlink for backwards
|
||||
# compatibility on x86, while crt1.o was added on sparc, so check for that.
|
||||
case ${host} in
|
||||
i?86-*-solaris2* | x86_64-*-solaris2*)
|
||||
if test -h "$libgcc_libdir/gcrt1.o"; then libgcc_cv_solaris_crts=yes; fi
|
||||
;;
|
||||
sparc*-*-solaris2*)
|
||||
if test -f "$libgcc_libdir/crt1.o"; then libgcc_cv_solaris_crts=yes; fi
|
||||
;;
|
||||
esac])
|
||||
if test $libgcc_cv_solaris_crts = yes; then
|
||||
AC_DEFINE(HAVE_SOLARIS_CRTS, 1,
|
||||
[Define if the system-provided CRTs are present on Solaris.])
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# Determine the version of glibc, if any, used on the target.
|
||||
AC_MSG_CHECKING([for target glibc version])
|
||||
AC_ARG_WITH([glibc-version],
|
||||
|
Loading…
Reference in New Issue
Block a user