The patch to use -z ignore/-z record for libgcc_s on Solaris caused far
more problems than it initially seemed:

* Before Solaris 11 where dl_iterate_phdr is used, crtbegin.o contains
  references to
  __register_frame_info_bases/__deregister_frame_info_bases which cause
  libgcc_s.so.1 to be dragged into even the most trivial C program,
  which breaks bootstrap.

* On Solaris 11/x86 with gld, crt1.o is delivered with a reference to
  _DYNAMIC (unlike SPARC), which again drags in libgcc_s.so.1.  I don't
  yet know why this doesn't happen with Solaris ld.

Anyway, this patch disables -z ignore/--as-needed use in all those
configurations.

Bootstrapped without regressions on i386-pc-solaris2.{9,10,11} and
sparc-sun-solaris2.{9,10,11} with as/ld, gas/gld, installed on mainline.

        Rainer


2013-04-25  Rainer Orth  <r...@cebitec.uni-bielefeld.de>

        PR target/57261
        * configure.ac (gcc_cv_ld_as_needed): Disable before Solaris 11
        and Solaris 11+/x86 with gld.
        * configure: Regenerate.

# HG changeset patch
# Parent a618b2ae5c9b7838e4785a8179e0a67fb55365f7
Fix Solaris --as-needed/-z ignore detection

diff --git a/gcc/configure.ac b/gcc/configure.ac
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -4560,6 +4560,23 @@ elif test x$gcc_cv_ld != x; then
 	  esac
 	fi
 fi
+# --as-needed/-z ignore can only be used if libgcc_s.so.1 uses
+# dl_iterate_phdr, i.e. since Solaris 11.
+case "$target" in
+  *-*-solaris2.1[[1-9]]*)
+    case "$target" in
+    i?86-*-* | x86_64-*-*)
+      if echo "$ld_ver" | grep GNU > /dev/null; then
+        # Doesn't work with gld on Solaris/x86 due to PR ld/12320.
+        gcc_cv_ld_as_needed=no
+      fi
+      ;;
+    esac
+    ;;
+  *-*-solaris2*)
+    gcc_cv_ld_as_needed=no
+    ;;
+esac
 ])
 if test x"$gcc_cv_ld_as_needed" = xyes; then
 	AC_DEFINE(HAVE_LD_AS_NEEDED, 1,
-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

Reply via email to