develooper Front page | perl.perl5.porters | Postings from March 2000

solaris 64-bit and gcc

Thread Next
From:
Robin Barker
Date:
March 1, 2000 09:59
Subject:
solaris 64-bit and gcc
Message ID:
200003011759.RAA03938@tempest.npl.co.uk
I tried 
   ./Configure -des -Dcc=gcc -Duse64bitall

and Configure suggested my compiler was broken.
[ hints/solaris.sh creates a call back unit for use64bitall
  which it calls immediately, this sets some invalid flags. ]

I find that the correct flag was -mcpu=v9 not -mv9 but then
gcc fell over at the assembler stage;
I added -Wa,-xarch=v9 and the assembler worked but the link-
editor failed (with "wrong machine class"), but the man page
for ld claims it can do 64- or 32- bit and will determine this
from the object file.

I guessed I also wanted -m64 to get 64-bit pointers etc., but
this failed with "-m64 is not supported by this configuration".

So, I offer the following patch to hints/solaris-2.sh which is
my best attempt at matching use64bitall to my machine.  Some
of these changes remain guess, just like the text they replace.

Robin  

--- hints/solaris_2.sh	2000/03/01 11:27:53	1.1
+++ hints/solaris_2.sh	2000/03/01 17:56:23	1.2
@@ -370,7 +370,7 @@
 "$define"|true|[yY]*)
 	    libc='/usr/lib/sparcv9/libc.so'
 	    if test ! -f $libc; then
-		cat <<EOM
+		cat >&4 <<EOM
 
 I do not see the 64-bit libc, $libc.
 Cannot continue, aborting.
@@ -381,11 +381,27 @@
 	    loclibpth="$loclibpth /usr/lib/sparcv9"
 	    case "$cc -v 2>/dev/null" in
 	    *gcc*)
-		# I don't know what are the flags to make gcc sparcv9-aware,
-	        # I'm just guessing. --jhi
-		ccflags="$ccflags -mv9"
-		ldflags="$ldflags -mv9"
-		lddlflags="$lddlflags -G -mv9"
+		echo 'main() { return 0; }' > try.c
+		if ${cc:-cc} -mcpu=v9 -m64 -S try.c 2>&1 | grep -e \
+		    '-m64 is not supported by this configuration'; then
+		    cat >&4 <<EOM
+
+Full 64-bit build not supported by this configuration.
+Cannot continue, aborting.
+
+EOM
+		    exit 1
+		fi
+		ccflags="$ccflags -mcpu=v9 -m64"
+		if test X`getconf XBS5_LP64_OFF64_CFLAGS 2>/dev/null` != X; then
+		    ccflags="$ccflags -Wa,`getconf XBS5_LP64_OFF64_CFLAGS 2>/dev/null`"
+		fi
+		# no changes to ld flags, as (according to man ld):
+		#
+   		# There is no specific option that tells ld to link 64-bit
+		# objects; the class of the first object that gets processed
+		# by ld determines whether it is to perform a 32-bit or a
+		# 64-bit link edit.
 		;;
 	    *)
 		ccflags="$ccflags `getconf XBS5_LP64_OFF64_CFLAGS 2>/dev/null`"

-- 
Robin Barker                        | Eail:  Robin.Barker@npl.co.uk
CISE, Building 10,                  | Phone: +44 (0) 20 8943 7090
National Physical Laboratory,       | Fax:   +44 (0) 20 8977 7091
Teddington, Middlesex, UK. TW11 OLW | WWW:   http://www.npl.co.uk

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About