Patchwork [build] Support libgo on Solaris 2

login
register
mail settings
Submitter Rainer Orth
Date Jan. 14, 2011, 4:09 p.m.
Message ID <yddk4i7piup.fsf@manam.CeBiTec.Uni-Bielefeld.DE>
Download mbox | patch
Permalink /patch/78947/
State New
Headers show

Comments

Rainer Orth - Jan. 14, 2011, 4:09 p.m.
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.
Paolo Bonzini - Jan. 14, 2011, 4:17 p.m.
On 01/14/2011 05:09 PM, Rainer Orth wrote:
> 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.

Agreed.

>> 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.

Looks ok, sorry for not reading the thread until today.

Just one question:

> +      # Solaris 2 ld always supports -Bstatic/-Bdynamic.
> +      *-*-solaris2*)
> +        gcc_cv_ld_static_dynamic=yes
> +        ;;
> +    esac
> +  fi

If Solaris 2 ld always supports the option, shouldn't the variable be 
set to yes even if gcc_cv_ld is empty?

Paolo
Rainer Orth - Jan. 14, 2011, 4:32 p.m.
Paolo Bonzini <bonzini@gnu.org> writes:

> Just one question:
>
>> +      # Solaris 2 ld always supports -Bstatic/-Bdynamic.
>> +      *-*-solaris2*)
>> +        gcc_cv_ld_static_dynamic=yes
>> +        ;;
>> +    esac
>> +  fi
>
> If Solaris 2 ld always supports the option, shouldn't the variable be set
> to yes even if gcc_cv_ld is empty?

Only in the native case, so the test may be incomplete here, but I'm
uncertain what's the best way to deal with this.  It also seems that
gcc_cv_ld is always set (at least there seem to be a couple of uses that
don't check if it is set).

Btw, the gcc_cv_ld_static_dynamic check is immediately below a comment

# Target-specific assembler checks.

which doesn't fit ;-(

	Rainer

Patch

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,