aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>2013-04-15 10:31:57 +0000
committerRainer Orth <ro@gcc.gnu.org>2013-04-15 10:31:57 +0000
commite927b6ad355c068ce2030bdec5a23db8d7a41496 (patch)
treec14f024bbdb6a514a3b90e6bfd980a6fc278ed5a /gcc
parente0ea8797bb997ccc5ab228580498dfe2b727dcef (diff)
downloadgcc-e927b6ad355c068ce2030bdec5a23db8d7a41496.zip
gcc-e927b6ad355c068ce2030bdec5a23db8d7a41496.tar.gz
gcc-e927b6ad355c068ce2030bdec5a23db8d7a41496.tar.bz2
Use -z ignore instead of --as-needed on Solaris
* configure.ac (gcc_cv_ld_as_needed): Set gcc_cv_ld_as_needed_option, gcc_cv_no_as_needed_option. Use -z ignore, -z record on *-*-solaris2*. (HAVE_LD_AS_NEEDED): Update comment. (LD_AS_NEEDED_OPTION, LD_NO_AS_NEEDED_OPTION): Define. * configure: Regenerate. * config.in: Regenerate. * gcc.c (init_gcc_specs) [USE_LD_AS_NEEDED]: Use LD_AS_NEEDED_OPTION, LD_NO_AS_NEEDED_OPTION. * config/sol2.h [HAVE_LD_AS_NEEDED] (USE_LD_AS_NEEDED): Define. * doc/tm.texi.in (USE_LD_AS_NEEDED): Allow for --as-needed equivalents. Fix markup. * doc/tm.texi: Regenerate. From-SVN: r197964
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog16
-rw-r--r--gcc/config.in15
-rw-r--r--gcc/config/sol2.h5
-rwxr-xr-xgcc/configure25
-rw-r--r--gcc/configure.ac17
-rw-r--r--gcc/doc/tm.texi3
-rw-r--r--gcc/doc/tm.texi.in3
-rw-r--r--gcc/gcc.c3
8 files changed, 80 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8ad6eb8..d4dbb22 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,19 @@
+2013-04-15 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * configure.ac (gcc_cv_ld_as_needed): Set
+ gcc_cv_ld_as_needed_option, gcc_cv_no_as_needed_option.
+ Use -z ignore, -z record on *-*-solaris2*.
+ (HAVE_LD_AS_NEEDED): Update comment.
+ (LD_AS_NEEDED_OPTION, LD_NO_AS_NEEDED_OPTION): Define.
+ * configure: Regenerate.
+ * config.in: Regenerate.
+ * gcc.c (init_gcc_specs) [USE_LD_AS_NEEDED]: Use
+ LD_AS_NEEDED_OPTION, LD_NO_AS_NEEDED_OPTION.
+ * config/sol2.h [HAVE_LD_AS_NEEDED] (USE_LD_AS_NEEDED): Define.
+ * doc/tm.texi.in (USE_LD_AS_NEEDED): Allow for --as-needed
+ equivalents. Fix markup.
+ * doc/tm.texi: Regenerate.
+
2013-04-15 Andrew Hsieh <andrewhsieh.google.com>
* config/i386/i386.opt: New option mstack-protector-guard=.
diff --git a/gcc/config.in b/gcc/config.in
index de8271b..66e47ca 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -1205,7 +1205,8 @@
#endif
-/* Define if your linker supports --as-needed and --no-as-needed options. */
+/* Define if your linker supports --as-needed/--no-as-needed or equivalent
+ options. */
#ifndef USED_FOR_TARGET
#undef HAVE_LD_AS_NEEDED
#endif
@@ -1642,12 +1643,24 @@
#endif
+/* Define to the linker option to ignore unused dependencies. */
+#ifndef USED_FOR_TARGET
+#undef LD_AS_NEEDED_OPTION
+#endif
+
+
/* Define to the linker option to enable use of shared objects. */
#ifndef USED_FOR_TARGET
#undef LD_DYNAMIC_OPTION
#endif
+/* Define to the linker option to keep unused dependencies. */
+#ifndef USED_FOR_TARGET
+#undef LD_NO_AS_NEEDED_OPTION
+#endif
+
+
/* Define to the linker option to disable use of shared objects. */
#ifndef USED_FOR_TARGET
#undef LD_STATIC_OPTION
diff --git a/gcc/config/sol2.h b/gcc/config/sol2.h
index 23a5bf5..4c9b334 100644
--- a/gcc/config/sol2.h
+++ b/gcc/config/sol2.h
@@ -181,6 +181,11 @@ along with GCC; see the file COPYING3. If not see
%(link_arch) \
%{Qy:} %{!Qn:-Qy}"
+/* Use --as-needed/-z ignore -lgcc_s for eh support. */
+#ifdef HAVE_LD_AS_NEEDED
+#define USE_LD_AS_NEEDED 1
+#endif
+
#ifdef USE_GLD
/* Solaris 11 build 135+ implements dl_iterate_phdr. GNU ld needs
--eh-frame-hdr to create the required .eh_frame_hdr sections. */
diff --git a/gcc/configure b/gcc/configure
index b838906..a33da7a 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -17830,7 +17830,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 17831 "configure"
+#line 17833 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -17936,7 +17936,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 17937 "configure"
+#line 17939 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -26557,6 +26557,8 @@ if test "${gcc_cv_ld_as_needed+set}" = set; then :
$as_echo_n "(cached) " >&6
else
gcc_cv_ld_as_needed=no
+gcc_cv_ld_as_needed_option='--as-needed'
+gcc_cv_ld_no_as_needed_option='--no-as-needed'
if test $in_tree_ld = yes ; then
if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 16 -o "$gcc_cv_gld_major_version" -gt 2 \
&& test $in_tree_ld_is_elf = yes; then
@@ -26566,6 +26568,15 @@ elif test x$gcc_cv_ld != x; then
# Check if linker supports --as-needed and --no-as-needed options
if $gcc_cv_ld --help 2>/dev/null | grep as-needed > /dev/null; then
gcc_cv_ld_as_needed=yes
+ else
+ case "$target" in
+ # Solaris 2 ld always supports -z ignore/-z record.
+ *-*-solaris2*)
+ gcc_cv_ld_as_needed=yes
+ gcc_cv_ld_as_needed_option="-z ignore"
+ gcc_cv_ld_no_as_needed_option="-z record"
+ ;;
+ esac
fi
fi
@@ -26576,6 +26587,16 @@ if test x"$gcc_cv_ld_as_needed" = xyes; then
$as_echo "#define HAVE_LD_AS_NEEDED 1" >>confdefs.h
+
+cat >>confdefs.h <<_ACEOF
+#define LD_AS_NEEDED_OPTION "$gcc_cv_ld_as_needed_option"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define LD_NO_AS_NEEDED_OPTION "$gcc_cv_ld_no_as_needed_option"
+_ACEOF
+
fi
case "$target:$tm_file" in
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 068c66a..1d5175b 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -4538,6 +4538,8 @@ AC_MSG_RESULT($gcc_cv_ld_eh_gc_sections_bug)
AC_CACHE_CHECK(linker --as-needed support,
gcc_cv_ld_as_needed,
[gcc_cv_ld_as_needed=no
+gcc_cv_ld_as_needed_option='--as-needed'
+gcc_cv_ld_no_as_needed_option='--no-as-needed'
if test $in_tree_ld = yes ; then
if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 16 -o "$gcc_cv_gld_major_version" -gt 2 \
&& test $in_tree_ld_is_elf = yes; then
@@ -4547,12 +4549,25 @@ elif test x$gcc_cv_ld != x; then
# Check if linker supports --as-needed and --no-as-needed options
if $gcc_cv_ld --help 2>/dev/null | grep as-needed > /dev/null; then
gcc_cv_ld_as_needed=yes
+ else
+ case "$target" in
+ # Solaris 2 ld always supports -z ignore/-z record.
+ *-*-solaris2*)
+ gcc_cv_ld_as_needed=yes
+ gcc_cv_ld_as_needed_option="-z ignore"
+ gcc_cv_ld_no_as_needed_option="-z record"
+ ;;
+ esac
fi
fi
])
if test x"$gcc_cv_ld_as_needed" = xyes; then
AC_DEFINE(HAVE_LD_AS_NEEDED, 1,
-[Define if your linker supports --as-needed and --no-as-needed options.])
+[Define if your linker supports --as-needed/--no-as-needed or equivalent options.])
+ AC_DEFINE_UNQUOTED(LD_AS_NEEDED_OPTION, "$gcc_cv_ld_as_needed_option",
+[Define to the linker option to ignore unused dependencies.])
+ AC_DEFINE_UNQUOTED(LD_NO_AS_NEEDED_OPTION, "$gcc_cv_ld_no_as_needed_option",
+[Define to the linker option to keep unused dependencies.])
fi
case "$target:$tm_file" in
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index e1df98f..c88a89f 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -260,7 +260,8 @@ line, but, unlike @code{LIBGCC_SPEC}, it is used unmodified.
@defmac USE_LD_AS_NEEDED
A macro that controls the modifications to @code{LIBGCC_SPEC}
mentioned in @code{REAL_LIBGCC_SPEC}. If nonzero, a spec will be
-generated that uses --as-needed and the shared libgcc in place of the
+generated that uses @option{--as-needed} or equivalent options and the
+shared @file{libgcc} in place of the
static exception handler library, when linking without any of
@code{-static}, @code{-static-libgcc}, or @code{-shared-libgcc}.
@end defmac
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index 964f2e7..d70ce4c 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -260,7 +260,8 @@ line, but, unlike @code{LIBGCC_SPEC}, it is used unmodified.
@defmac USE_LD_AS_NEEDED
A macro that controls the modifications to @code{LIBGCC_SPEC}
mentioned in @code{REAL_LIBGCC_SPEC}. If nonzero, a spec will be
-generated that uses --as-needed and the shared libgcc in place of the
+generated that uses @option{--as-needed} or equivalent options and the
+shared @file{libgcc} in place of the
static exception handler library, when linking without any of
@code{-static}, @code{-static-libgcc}, or @code{-shared-libgcc}.
@end defmac
diff --git a/gcc/gcc.c b/gcc/gcc.c
index bcfbfc8..27072f0 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -1361,7 +1361,8 @@ init_gcc_specs (struct obstack *obstack, const char *shared_name,
"%{!static:%{!static-libgcc:"
#if USE_LD_AS_NEEDED
"%{!shared-libgcc:",
- static_name, " --as-needed ", shared_name, " --no-as-needed"
+ static_name, " " LD_AS_NEEDED_OPTION " ",
+ shared_name, " " LD_NO_AS_NEEDED_OPTION
"}"
"%{shared-libgcc:",
shared_name, "%{!shared: ", static_name, "}"