public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [build, c++, fortran, go] Use -noso/-so_archive instead of -Bstatic/-Bdynamic on Tru64 UNIX
@ 2011-01-28 12:38 Rainer Orth
  2011-01-28 13:55 ` Paolo Bonzini
  2011-01-28 16:12 ` Ian Lance Taylor
  0 siblings, 2 replies; 3+ messages in thread
From: Rainer Orth @ 2011-01-28 12:38 UTC (permalink / raw)
  To: gcc-patches; +Cc: fortran, Paolo Bonzini, Ian Lance Taylor, Richard Guenther

Like its Solaris and IRIX counterparts, the Tru64 UNIX linker has
support for forcing static or allowing dynamic linking.  This is
necessary to make -static-libstdc++ work, which again is a prerequisite
for Go support and graphite.

The only problem is that the necessary options are called
-noso/-so_archive instead of -Bstatic/-Bdynamic.  The following patch
implements this.  Though larger than the Solaris and IRIX versions, it's
pretty mechanical and I hope to get it into 4.6 so Go and/or graphite
can be made work on Tru64 UNIX.

Tested by a --enable-languages=go bootstrap on alpha-dec-osf5.1b so far,
and go1 was linked statically with libstdc++.  I expect to test it on
both IRIX and Solaris over the weekend to make sure none of the
-Bstatic/-Bdynamic platforms broke.

Ok for mainline afterwards?

	Rainer


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

	gcc:
	* configure.ac (gcc_cv_ld_static_option): Define.
	(gcc_cv_ld_dynamic_option): Define.
	(gcc_cv_ld_static_dynamic): Tru64 UNIX support -noso/-so_archive
	instead.
	(HAVE_LD_STATIC_DYNAMIC): Update message.
	(LD_STATIC_OPTION): Define.
	(LD_DYNAMIC_OPTION): Define.
	* configure: Regenerate.
	* config.in: Regenerate.
	* gcc.c (init_spec) [USE_LIBUNWIND_EXCEPTIONS &&
	HAVE_LD_STATIC_DYNAMIC]: Use them.

	gcc/cp:
	* g++spec.c (lang_specific_driver) [HAVE_LD_STATIC_DYNAMIC] Use
	LD_STATIC_OPTION, LD_DYNAMIC_OPTION.

	gcc/fortran:
	* gfortranspec.c (add_arg_libgfortran) [HAVE_LD_STATIC_DYNAMIC] Use
	LD_STATIC_OPTION, LD_DYNAMIC_OPTION.

	gcc/go:
	* gospec.c (lang_specific_driver) [HAVE_LD_STATIC_DYNAMIC] Use
	LD_STATIC_OPTION, LD_DYNAMIC_OPTION.

diff -r c9252da4cfd9 gcc/configure.ac
--- a/gcc/configure.ac	Thu Jan 27 19:07:20 2011 +0100
+++ b/gcc/configure.ac	Thu Jan 27 19:36:02 2011 +0100
@@ -3112,6 +3112,8 @@
 
 AC_MSG_CHECKING(linker -Bstatic/-Bdynamic option)
 gcc_cv_ld_static_dynamic=no
+gcc_cv_ld_static_option='-Bstatic'
+gcc_cv_ld_dynamic_option='-Bdynamic'
 if test $in_tree_ld = yes ; then
   if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 10 -o "$gcc_cv_gld_major_version" -gt 2; then
     gcc_cv_ld_static_dynamic=yes
@@ -3123,6 +3125,12 @@
       gcc_cv_ld_static_dynamic=yes
   else
     case "$target" in
+      # Tru64 UNIX support -noso/-so_archive instead of -Bstatic/-Bdynamic.
+      alpha*-dec-osf*)
+        gcc_cv_ld_static_dynamic=yes
+	gcc_cv_ld_static_option="-noso"
+	gcc_cv_ld_dynamic_option="-so_archive"
+        ;;
       # IRIX 6 ld supports -Bstatic/-Bdynamic.
       mips-sgi-irix6*)
         gcc_cv_ld_static_dynamic=yes
@@ -3136,7 +3144,11 @@
 fi
 if test x"$gcc_cv_ld_static_dynamic" = xyes; then
 	AC_DEFINE(HAVE_LD_STATIC_DYNAMIC, 1,
-[Define if your linker supports -Bstatic/-Bdynamic option.])
+[Define if your linker supports -Bstatic/-Bdynamic or equivalent options.])
+	AC_DEFINE_UNQUOTED(LD_STATIC_OPTION, "$gcc_cv_ld_static_option",
+[Define to the linker option to disable use of shared objects.])
+	AC_DEFINE_UNQUOTED(LD_DYNAMIC_OPTION, "$gcc_cv_ld_dynamic_option",
+[Define to the linker option to enable use of shared objects.])
 fi
 AC_MSG_RESULT($gcc_cv_ld_static_dynamic)
 
diff -r c9252da4cfd9 gcc/cp/g++spec.c
--- a/gcc/cp/g++spec.c	Thu Jan 27 19:07:20 2011 +0100
+++ b/gcc/cp/g++spec.c	Thu Jan 27 19:36:02 2011 +0100
@@ -1,6 +1,6 @@
 /* Specific flags and argument handling of the C++ front end.
    Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-   2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+   2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -316,7 +316,7 @@
 #ifdef HAVE_LD_STATIC_DYNAMIC
       if (library > 1 && !static_link)
 	{
-	  generate_option (OPT_Wl_, "-Bstatic", 1, CL_DRIVER,
+	  generate_option (OPT_Wl_, LD_STATIC_OPTION, 1, CL_DRIVER,
 			   &new_decoded_options[j]);
 	  j++;
 	}
@@ -337,7 +337,7 @@
 #ifdef HAVE_LD_STATIC_DYNAMIC
       if (library > 1 && !static_link)
 	{
-	  generate_option (OPT_Wl_, "-Bdynamic", 1, CL_DRIVER,
+	  generate_option (OPT_Wl_, LD_DYNAMIC_OPTION, 1, CL_DRIVER,
 			   &new_decoded_options[j]);
 	  j++;
 	}
diff -r c9252da4cfd9 gcc/fortran/gfortranspec.c
--- a/gcc/fortran/gfortranspec.c	Thu Jan 27 19:07:20 2011 +0100
+++ b/gcc/fortran/gfortranspec.c	Thu Jan 27 19:36:02 2011 +0100
@@ -192,12 +192,12 @@
 {
 #ifdef HAVE_LD_STATIC_DYNAMIC
   if (force_static)
-    append_option (OPT_Wl_, "-Bstatic", 1);
+    append_option (OPT_Wl_, LD_STATIC_OPTION, 1);
 #endif
   append_option (OPT_l, FORTRAN_LIBRARY, 1);
 #ifdef HAVE_LD_STATIC_DYNAMIC
   if (force_static)
-    append_option (OPT_Wl_, "-Bdynamic", 1);
+    append_option (OPT_Wl_, LD_DYNAMIC_OPTION, 1);
 #endif
 }
 
diff -r c9252da4cfd9 gcc/gcc.c
--- a/gcc/gcc.c	Thu Jan 27 19:07:20 2011 +0100
+++ b/gcc/gcc.c	Thu Jan 27 19:36:02 2011 +0100
@@ -1375,7 +1375,8 @@
 			    "-lgcc_eh"
 #ifdef USE_LIBUNWIND_EXCEPTIONS
 # ifdef HAVE_LD_STATIC_DYNAMIC
-			    " %{!static:-Bstatic} -lunwind %{!static:-Bdynamic}"
+			    " %{!static:" LD_STATIC_OPTION "} -lunwind"
+			    " %{!static:" LD_DYNAMIC_OPTION "}"
 # else
 			    " -lunwind"
 # endif
diff -r c9252da4cfd9 gcc/go/gospec.c
--- a/gcc/go/gospec.c	Thu Jan 27 19:07:20 2011 +0100
+++ b/gcc/go/gospec.c	Thu Jan 27 19:36:02 2011 +0100
@@ -1,5 +1,5 @@
 /* gospec.c -- Specific flags and argument handling of the gcc Go front end.
-   Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+   Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -301,7 +301,7 @@
 #ifdef HAVE_LD_STATIC_DYNAMIC
       if (library > 1 && !static_link)
 	{
-	  generate_option (OPT_Wl_, "-Bstatic", 1, CL_DRIVER,
+	  generate_option (OPT_Wl_, LD_STATIC_OPTION, 1, CL_DRIVER,
 			   &new_decoded_options[j]);
 	  j++;
 	}
@@ -315,7 +315,7 @@
 #ifdef HAVE_LD_STATIC_DYNAMIC
       if (library > 1 && !static_link)
 	{
-	  generate_option (OPT_Wl_, "-Bdynamic", 1, CL_DRIVER,
+	  generate_option (OPT_Wl_, LD_DYNAMIC_OPTION, 1, CL_DRIVER,
 			   &new_decoded_options[j]);
 	  j++;
 	}

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [build, c++, fortran, go] Use -noso/-so_archive instead of -Bstatic/-Bdynamic on Tru64 UNIX
  2011-01-28 12:38 [build, c++, fortran, go] Use -noso/-so_archive instead of -Bstatic/-Bdynamic on Tru64 UNIX Rainer Orth
@ 2011-01-28 13:55 ` Paolo Bonzini
  2011-01-28 16:12 ` Ian Lance Taylor
  1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2011-01-28 13:55 UTC (permalink / raw)
  To: Rainer Orth; +Cc: gcc-patches, fortran, Ian Lance Taylor, Richard Guenther

On 01/28/2011 10:50 AM, Rainer Orth wrote:
> The only problem is that the necessary options are called
> -noso/-so_archive instead of -Bstatic/-Bdynamic.  The following patch
> implements this.  Though larger than the Solaris and IRIX versions, it's
> pretty mechanical and I hope to get it into 4.6 so Go and/or graphite
> can be made work on Tru64 UNIX.

The build parts are ok.

Paolo

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [build, c++, fortran, go] Use -noso/-so_archive instead of -Bstatic/-Bdynamic on Tru64 UNIX
  2011-01-28 12:38 [build, c++, fortran, go] Use -noso/-so_archive instead of -Bstatic/-Bdynamic on Tru64 UNIX Rainer Orth
  2011-01-28 13:55 ` Paolo Bonzini
@ 2011-01-28 16:12 ` Ian Lance Taylor
  1 sibling, 0 replies; 3+ messages in thread
From: Ian Lance Taylor @ 2011-01-28 16:12 UTC (permalink / raw)
  To: Rainer Orth; +Cc: gcc-patches, fortran, Paolo Bonzini, Richard Guenther

Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:

> 2011-01-27  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
>
> 	gcc:
> 	* configure.ac (gcc_cv_ld_static_option): Define.
> 	(gcc_cv_ld_dynamic_option): Define.
> 	(gcc_cv_ld_static_dynamic): Tru64 UNIX support -noso/-so_archive
> 	instead.
> 	(HAVE_LD_STATIC_DYNAMIC): Update message.
> 	(LD_STATIC_OPTION): Define.
> 	(LD_DYNAMIC_OPTION): Define.
> 	* configure: Regenerate.
> 	* config.in: Regenerate.
> 	* gcc.c (init_spec) [USE_LIBUNWIND_EXCEPTIONS &&
> 	HAVE_LD_STATIC_DYNAMIC]: Use them.
>
> 	gcc/cp:
> 	* g++spec.c (lang_specific_driver) [HAVE_LD_STATIC_DYNAMIC] Use
> 	LD_STATIC_OPTION, LD_DYNAMIC_OPTION.
>
> 	gcc/fortran:
> 	* gfortranspec.c (add_arg_libgfortran) [HAVE_LD_STATIC_DYNAMIC] Use
> 	LD_STATIC_OPTION, LD_DYNAMIC_OPTION.
>
> 	gcc/go:
> 	* gospec.c (lang_specific_driver) [HAVE_LD_STATIC_DYNAMIC] Use
> 	LD_STATIC_OPTION, LD_DYNAMIC_OPTION.

This is OK.  It seems to me to be a pure bug fix for Tru64, but please
give the RM's a chance to object before committing.

Thanks.

Ian

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-01-28 15:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-28 12:38 [build, c++, fortran, go] Use -noso/-so_archive instead of -Bstatic/-Bdynamic on Tru64 UNIX Rainer Orth
2011-01-28 13:55 ` Paolo Bonzini
2011-01-28 16:12 ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).