This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [build] Support libgo on Solaris 2


Paolo Bonzini <bonzini@gnu.org> writes:

> The way to build a proper feature test would be to compile a sample dynamic
> library that uses printf, link it with -Bsymbolic, compile another program
> that overrides printf and links with the dynamic library, run the program,
> and check that the overridden printf is not used.

That's why I mentioned that proper linker feature tests can become quite
complicated.

> I think that in this case a case statement is better.

I suppose the following patch is ok then?  It allowed bootstraps with Go
included to complete on i386-pc-solaris2.10 (gas/gld),
i386-pc-solaris2.11 (as/ld), and sparc-sun-solaris2.11 (as/ld).

Btw., before Solaris 11, GNU ld is currently required because
libgo/Makefile.am (BUILDGOX) has a hardcoded use of -Wl,--whole-archive
which older vendor linkers are unlikely to understand.  It happens to
work on Solaris 11 since ld aquired may GNU ld command line options.

	Rainer


2011-01-13  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* configure.ac (gcc_cv_ld_static_dynamic): Solaris 2 ld always
	supports -Bstatic/-Bdynamic.
	* configure: Regenerate.

diff -r 834971b1dce5 gcc/configure.ac
--- a/gcc/configure.ac	Fri Jan 14 10:10:37 2011 +0100
+++ b/gcc/configure.ac	Fri Jan 14 10:14:34 2011 +0100
@@ -3166,11 +3166,18 @@
     gcc_cv_ld_static_dynamic=yes
   fi
 elif test x$gcc_cv_ld != x; then
-	# Check if linker supports -Bstatic/-Bdynamic option
-	if $gcc_cv_ld --help 2>/dev/null | grep -- -Bstatic > /dev/null \
-	  && $gcc_cv_ld --help 2>/dev/null | grep -- -Bdynamic > /dev/null; then
-		gcc_cv_ld_static_dynamic=yes
-	fi
+  # Check if linker supports -Bstatic/-Bdynamic option
+  if $gcc_cv_ld --help 2>/dev/null | grep -- -Bstatic > /dev/null \
+     && $gcc_cv_ld --help 2>/dev/null | grep -- -Bdynamic > /dev/null; then
+      gcc_cv_ld_static_dynamic=yes
+  else
+    case "$target" in
+      # Solaris 2 ld always supports -Bstatic/-Bdynamic.
+      *-*-solaris2*)
+        gcc_cv_ld_static_dynamic=yes
+        ;;
+    esac
+  fi
 fi
 if test x"$gcc_cv_ld_static_dynamic" = xyes; then
 	AC_DEFINE(HAVE_LD_STATIC_DYNAMIC, 1,


-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]