Re: Use sparcv9-sun-solaris2.* with 64-bit compiler

2019-01-02 Thread Ben Elliston
Hi Rainer

On Wed, Jan 02, 2019 at 12:49:19PM +0100, Rainer Orth wrote:

> Everything behaved as expected.

Thanks for the well-tested and well-documented patch!

> One thing I'm uncertain about is the need for testcases
> corresponding to this change?

I have added some test cases, best as we can do when not running the
testsuite on the actual system. I fixed things up to run the
config.guess under test with CC_FOR_BUILD set to
'no_compiler_found'. That is an improvement for testing these more
complex cases.

Cheers, Ben


signature.asc
Description: PGP signature
___
config-patches mailing list
config-patches@gnu.org
https://lists.gnu.org/mailman/listinfo/config-patches


Use sparcv9-sun-solaris2.* with 64-bit compiler

2019-01-02 Thread Rainer Orth
Before being sidetracked by the thread starting at

http://lists.gnu.org/archive/html/config-patches/2018-12/msg6.html

I intended to submit the following patch to bring Solaris/SPARC in line
with what is already done for Solaris/x86, i.e. return a 64-bit triplet
when a 64-bit compiler is in use.

This would have avoided the GCC issue tracked as

PR target/88535
sparcv9 gcc 7 causes comparison failure in sparc gcc 8 dwarf2out.o
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88535

in the first place and of course removes an unnecessary inconsistence
between Solaris/SPARC and x86.

With the Solaris/x86 issue now settled, here's the patch I meant to send
back then: when a 64-bit compiler (either by default, with cc
-xarch=v9/-m64 or gcc -m64) is used, return sparcv9-sun-solaris2.*
instead of sparc-sun-solaris2.*.

A couple of comments are in order:

* I decided to also cover tadpole: they produced an Ultrabook,
  essentially a portable Ultra 1/170E running Solaris 8 which benefits
  from this change should any of those still be around.

* __LP64__ is only defined since Studio 12.6 cc, so the comment still
  applies.

* I chose to use sparcv9 instead of sparc64; it's the canonical name for
  64-bit sparc on Solaris.  The same would apply for 64-bit Solaris/x86
  which should have been amd64-pc-solaris2.* in the first place, but
  given that the x86_64 form is already in use for a long time and the
  triplet is sometimes used as a directory name, such a change seems
  unnecessarily intrusive at this point.

I've tested the patch with

* Studio 11 (the oldest version I still have around) and Studio 12.6 (cc
  -xarch=v9, -m64 was only introduced in 12.1)

* GCC 3.4.6 and GCC 8.1.0

* Solaris 8 and Solaris 11.5 Beta

Everything behaved as expected.

One thing I'm uncertain about is the need for testcases corresponding to
this change?

Thanks.
Rainer

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


2019-01-02  Rainer Orth  

* config.guess (sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*): Return
sparcv9-sun-solaris2.* with 64-bit compiler.

diff --git a/config.guess b/config.guess
--- a/config.guess
+++ b/config.guess
@@ -385,7 +385,20 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAM
 	echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
 	exit ;;
 sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
-	echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
+	set_cc_for_build
+	SUN_ARCH=sparc
+	# If there is a compiler, see if it is configured for 64-bit objects.
+	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
+	# This test works for both compilers.
+	if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
+	if (echo '#ifdef __sparcv9'; echo IS_64BIT_ARCH; echo '#endif') | \
+		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+		grep IS_64BIT_ARCH >/dev/null
+	then
+		SUN_ARCH=sparcv9
+	fi
+	fi
+	echo "$SUN_ARCH"-sun-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
 	exit ;;
 i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
 	echo i386-pc-auroraux"$UNAME_RELEASE"
___
config-patches mailing list
config-patches@gnu.org
https://lists.gnu.org/mailman/listinfo/config-patches