public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug bootstrap/21542] New: gcc 4.0.0 assumes all i386-pc-solaris2.10 platforms have 64-bit processors
@ 2005-05-13  2:21 Daniel dot Davies at xerox dot com
  2005-05-13  2:25 ` [Bug bootstrap/21542] " Daniel dot Davies at xerox dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Daniel dot Davies at xerox dot com @ 2005-05-13  2:21 UTC (permalink / raw)
  To: gcc-bugs

I've been trying to build GCC 4.0.0 on an ordinary Intel PC running Solaris
2.10.  The base compiler is gcc3.4.2 from Sun's Companion CD.  I'm using
binutils-2.16 and fetched bison 2.0 (though that probably wasn't necessary).

GCC 4.0.0 assumes all i386-pc-solaris2.10 boxes have 64-bit processors.  The
problems occur when you try to build libcpp.  First, you get problems because
the new xgcc generates 64-bit opcodes which the assembler can't assemble and a 

Pentium can't execute.  Once you fix that, you have very odd problems in which
the new xgcc thinks all bitfield lengths equal to 0.

This problem arises because uname won't tell you whether the current platform
has a 32-bit or 64-bit processor.  isalist can (sort of) in that it lists
"amd64" as one of the instruction sets supported when running on 64-bit
platforms.  The modifications shown below should probably look for instruction
sets other than "amd64".  I have not tested the fix described below on a real
64-bit platform because I don't have one.  I found out about "amd64" by asking a
friend what happened when he typed "isalist" on his 64-bit Solaris box.

I only compiled gcc-core and gcc-g++.  I don't know if there are similar
problems with the other members of the compiler suite.

I had to make the following changes to make things work:

1. Modify gcc-4.0.0/gcc/config.gcc
 I changed

case ${target} in
	*-*-solaris2.1[0-9]*)
		tm_file="${tm_file} i386/x86-64.h i386/sol2-10.h"
		tm_defines="${tm_defines} TARGET_BI_ARCH=1"
		tmake_file="$tmake_file i386/t-sol2-10"
		need_64bit_hwint=yes
		# Solaris 2.10 provides crt1.o, crti.o, crtn.o, and gcrt1.o as 
		# part of the base system.
		extra_parts="gmon.o crtbegin.o crtend.o"
		;;
	*)
		extra_parts="crt1.o crti.o crtn.o gcrt1.o gmon.o crtbegin.o crtend.o"
		;;

to

	case ${target} in
	*-*-solaris2.1[0-9]*)
		# If this is a 32-bit platform, i.e. does not execute the
		# amd64 instruction set, do not include the 64-bit extensions.
		case `isalist | grep -c amd64` in
		0)
			tm_file="${tm_file} i386/sol2-10.h"
			tmake_file="$tmake_file i386/t-sol2-10-32"
			;;
		1)
			tm_file="${tm_file} i386/x86-64.h i386/sol2-10.h"
			tm_defines="${tm_defines} TARGET_BI_ARCH=1"
			tmake_file="$tmake_file i386/t-sol2-10"
			need_64bit_hwint=yes
			;;
		esac
		# Solaris 2.10 provides crt1.o, crti.o, crtn.o, and gcrt1.o as 
		# part of the base system.
		extra_parts="gmon.o crtbegin.o crtend.o"
		;;
	*)
		extra_parts="crt1.o crti.o crtn.o gcrt1.o gmon.o crtbegin.o crtend.o"
		;;

2, I added gcc-4.0.0/gcc/config/i386/t-sol2-10-32.  It contains

MULTILIB_OPTIONS = m32
MULTILIB_DIRNAMES = 32
MULTILIB_OSDIRNAMES = .

LIBGCC = stmp-multilib
INSTALL_LIBGCC = install-multilib

# GCC contains i386 assembler sources for some of the startfiles
# which aren't appropriate for amd64.  Just use the installed
# versions of: crt1.o crti.o crtn.o gcrt1.o
EXTRA_MULTILIB_PARTS=gmon.o crtbegin.o crtend.o

This may or may not have been necessary, but it seems tidy.

3. Those two changes convinced the new compiler to only emit 32-bit opcodes. 
The next problem was that the new compiler thought all bitfield lengths were 0.
 That's because it thought all constants encountered in source files had a value
of 0.  Boy, was that a lot of fumbling in the dark!  The cause of this was that
HOST_WIDE_INT was set to  "long long" instead of "long".  To fix this, I changed
gcc-4.0.0/libgcc/configure and gcc-4.0.0/libgcc/configure.ac as follows:

---------------------------------------------------------
case $target in
	alpha*-*-* | \
	arm*-*-eabi* | \
	arm*-*-symbianelf* | \
	x86_64-*-* | \
	ia64-*-* | \
	hppa*64*-*-* | parisc*64*-*-* | \
	i[34567]86-*-solaris2.1[0-9]* | \
	mips*-*-* | \
	mmix-*-* | \
	powerpc*-*-* | \
	rs6000*-*-* | \
	s390*-*-* | \
	sparc64*-*-* | ultrasparc-*-freebsd* | \
	sparcv9-*-solaris2* | \
	sparc-*-solaris2.[789] | sparc-*-solaris2.1[0-9]* | \
	sh[123456789l]*-*-*)
		need_64bit_hwint=yes ;;
     *)
		need_64bit_hwint=no ;;
esac
---------------------------------------------------------

becomes

---------------------------------------------------------
need_64bit_hwint=no
case $target in
	alpha*-*-* | \
	arm*-*-eabi* | \
	arm*-*-symbianelf* | \
	x86_64-*-* | \
	ia64-*-* | \
	hppa*64*-*-* | parisc*64*-*-* | \
	mips*-*-* | \
	mmix-*-* | \
	powerpc*-*-* | \
	rs6000*-*-* | \
	s390*-*-* | \
	sparc64*-*-* | ultrasparc-*-freebsd* | \
	sparcv9-*-solaris2* | \
	sparc-*-solaris2.[789] | sparc-*-solaris2.1[0-9]* | \
	sh[123456789l]*-*-*)
		need_64bit_hwint=yes ;;

	i[34567]86-*-solaris2.1[0-9]*)
	    case `isalist | grep -c amd64` in
	    1)
	        need_64bit_hwint=yes ;;
	    esac ;;	
esac
---------------------------------------------------------

It would be better to look for all possible 64-bit x86 instruction sets, but
I'll leave that to you!

-- 
           Summary: gcc 4.0.0 assumes all i386-pc-solaris2.10 platforms have
                    64-bit processors
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: bootstrap
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: Daniel dot Davies at xerox dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i386-pc-solaris2.10
  GCC host triplet: i386-pc-solaris2.10
GCC target triplet: i386-pc-solaris2.10


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21542


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

* [Bug bootstrap/21542] gcc 4.0.0 assumes all i386-pc-solaris2.10 platforms have 64-bit processors
  2005-05-13  2:21 [Bug bootstrap/21542] New: gcc 4.0.0 assumes all i386-pc-solaris2.10 platforms have 64-bit processors Daniel dot Davies at xerox dot com
@ 2005-05-13  2:25 ` Daniel dot Davies at xerox dot com
  2005-05-13  2:27 ` Daniel dot Davies at xerox dot com
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Daniel dot Davies at xerox dot com @ 2005-05-13  2:25 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From Daniel dot Davies at xerox dot com  2005-05-13 02:25 -------
Created an attachment (id=8882)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=8882&action=view)
GCC configuration file

Modified to detect 32-bit processors running Solaris 2.10

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21542


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

* [Bug bootstrap/21542] gcc 4.0.0 assumes all i386-pc-solaris2.10 platforms have 64-bit processors
  2005-05-13  2:21 [Bug bootstrap/21542] New: gcc 4.0.0 assumes all i386-pc-solaris2.10 platforms have 64-bit processors Daniel dot Davies at xerox dot com
  2005-05-13  2:25 ` [Bug bootstrap/21542] " Daniel dot Davies at xerox dot com
@ 2005-05-13  2:27 ` Daniel dot Davies at xerox dot com
  2005-05-13 11:18 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Daniel dot Davies at xerox dot com @ 2005-05-13  2:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From Daniel dot Davies at xerox dot com  2005-05-13 02:27 -------
Created an attachment (id=8883)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=8883&action=view)
libcpp configuration file

Detects 32-bit processors running Solaris 2.10

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21542


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

* [Bug bootstrap/21542] gcc 4.0.0 assumes all i386-pc-solaris2.10 platforms have 64-bit processors
  2005-05-13  2:21 [Bug bootstrap/21542] New: gcc 4.0.0 assumes all i386-pc-solaris2.10 platforms have 64-bit processors Daniel dot Davies at xerox dot com
  2005-05-13  2:25 ` [Bug bootstrap/21542] " Daniel dot Davies at xerox dot com
  2005-05-13  2:27 ` Daniel dot Davies at xerox dot com
@ 2005-05-13 11:18 ` pinskia at gcc dot gnu dot org
  2005-05-13 13:17 ` joseph at codesourcery dot com
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-13 11:18 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-13 11:17 -------
Try instead using --disable-multilib, that will work instead.
also if you did not move the need_64bit_hwint=yes part to the 64bit part, then you don't need to 
change libcpp.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21542


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

* [Bug bootstrap/21542] gcc 4.0.0 assumes all i386-pc-solaris2.10 platforms have 64-bit processors
  2005-05-13  2:21 [Bug bootstrap/21542] New: gcc 4.0.0 assumes all i386-pc-solaris2.10 platforms have 64-bit processors Daniel dot Davies at xerox dot com
                   ` (2 preceding siblings ...)
  2005-05-13 11:18 ` pinskia at gcc dot gnu dot org
@ 2005-05-13 13:17 ` joseph at codesourcery dot com
  2005-05-13 21:18 ` Daniel dot Davies at xerox dot com
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: joseph at codesourcery dot com @ 2005-05-13 13:17 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From joseph at codesourcery dot com  2005-05-13 13:17 -------
Subject: Re:  New: gcc 4.0.0 assumes all i386-pc-solaris2.10
 platforms have 64-bit processors

On Fri, 13 May 2005, Daniel dot Davies at xerox dot com wrote:

> I've been trying to build GCC 4.0.0 on an ordinary Intel PC running Solaris
> 2.10.  The base compiler is gcc3.4.2 from Sun's Companion CD.  I'm using
> binutils-2.16 and fetched bison 2.0 (though that probably wasn't necessary).

You haven't given a proper bug report explaining what you did, i.e. the 
specific commands used; instead you've just given your guesses as to the 
problems being in GCC whereas some appear to be in your configuration.

Try using the configuration recommended at 
http://gcc.gnu.org/install/specific.html (notes added after the 4.0.0 
release), i.e. configure --with-gnu-as --with-as=/usr/sfw/bin/gas 
--without-gnu-ld --with-ld=/usr/ccs/bin/ld.  Building with GNU ld may or 
may not work and building with Sun ld but more recent GNU as than that 
included with the system runs into problems because of inadequate COMDAT 
support in the linker.

> GCC 4.0.0 assumes all i386-pc-solaris2.10 boxes have 64-bit processors.  The
> problems occur when you try to build libcpp.  First, you get problems because
> the new xgcc generates 64-bit opcodes which the assembler can't assemble and a 

You should be using an assembler capable of assembling both 32-bit and 
64-bit code.  Try /usr/sfw/bin/gas.  The new xgcc should be defaulting to 
32-bit.  I don't think the new xgcc should be building libcpp at all until 
toplevel bootstrap is on by default.

It is a design feature of this port that the compiler can run on a 
32-bit-only box and build 64-bit binaries with -m64.  It may not be 
strictly required that the compiler will *build* on such boxes and still 
be able to build both 32-bit and 64-bit binaries, but in general trying to 
execute code as part of multilib configuration tests may be a bug; if you 
run into 64-bit runtime library configure tests trying to execute 64-bit 
binaries, give a more specific report of that problem.

> This problem arises because uname won't tell you whether the current platform
> has a 32-bit or 64-bit processor.  isalist can (sort of) in that it lists
> "amd64" as one of the instruction sets supported when running on 64-bit
> platforms.  The modifications shown below should probably look for instruction
> sets other than "amd64".  I have not tested the fix described below on a real
> 64-bit platform because I don't have one.  I found out about "amd64" by asking a
> friend what happened when he typed "isalist" on his 64-bit Solaris box.

The configuration should not depend on commands like isalist.  Remember 
that it is a design feature of GCC that almost all configurations can be 
built as cross-compilers.  The target i386-pc-solaris2.10 should mean the 
same thing everywhere regardless of features of your host; if doing a 
native build on a 32-bit-only system, the only restriction should be the 
configuration of the -m64 multilibs can't execute 64-bit code.

You can of course configure with --disable-multilib if you don't want the 
facility to build 64-bit binaries at all.  HOST_WIDE_INT being 64 bits 
should cause no problems for a 32-bit-only compiler, other than being 
slightly less efficient.



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21542


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

* [Bug bootstrap/21542] gcc 4.0.0 assumes all i386-pc-solaris2.10 platforms have 64-bit processors
  2005-05-13  2:21 [Bug bootstrap/21542] New: gcc 4.0.0 assumes all i386-pc-solaris2.10 platforms have 64-bit processors Daniel dot Davies at xerox dot com
                   ` (3 preceding siblings ...)
  2005-05-13 13:17 ` joseph at codesourcery dot com
@ 2005-05-13 21:18 ` Daniel dot Davies at xerox dot com
  2005-06-05  7:50 ` pinskia at gcc dot gnu dot org
  2005-06-05  7:51 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: Daniel dot Davies at xerox dot com @ 2005-05-13 21:18 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From Daniel dot Davies at xerox dot com  2005-05-13 21:18 -------
Thank you both for your helpful comments.  My big mistake was not going to the
gcc site for the updated configuration instructions when my build wasn't going
well.  Configuring the build as described in the latest instructions did the trick!

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21542


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

* [Bug bootstrap/21542] gcc 4.0.0 assumes all i386-pc-solaris2.10 platforms have 64-bit processors
  2005-05-13  2:21 [Bug bootstrap/21542] New: gcc 4.0.0 assumes all i386-pc-solaris2.10 platforms have 64-bit processors Daniel dot Davies at xerox dot com
                   ` (4 preceding siblings ...)
  2005-05-13 21:18 ` Daniel dot Davies at xerox dot com
@ 2005-06-05  7:50 ` pinskia at gcc dot gnu dot org
  2005-06-05  7:51 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-05  7:50 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-05 07:50 -------
Reopening to ...

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|FIXED                       |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21542


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

* [Bug bootstrap/21542] gcc 4.0.0 assumes all i386-pc-solaris2.10 platforms have 64-bit processors
  2005-05-13  2:21 [Bug bootstrap/21542] New: gcc 4.0.0 assumes all i386-pc-solaris2.10 platforms have 64-bit processors Daniel dot Davies at xerox dot com
                   ` (5 preceding siblings ...)
  2005-06-05  7:50 ` pinskia at gcc dot gnu dot org
@ 2005-06-05  7:51 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-05  7:51 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-05 07:51 -------
Mark as invalid.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21542


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

end of thread, other threads:[~2005-06-05  7:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-13  2:21 [Bug bootstrap/21542] New: gcc 4.0.0 assumes all i386-pc-solaris2.10 platforms have 64-bit processors Daniel dot Davies at xerox dot com
2005-05-13  2:25 ` [Bug bootstrap/21542] " Daniel dot Davies at xerox dot com
2005-05-13  2:27 ` Daniel dot Davies at xerox dot com
2005-05-13 11:18 ` pinskia at gcc dot gnu dot org
2005-05-13 13:17 ` joseph at codesourcery dot com
2005-05-13 21:18 ` Daniel dot Davies at xerox dot com
2005-06-05  7:50 ` pinskia at gcc dot gnu dot org
2005-06-05  7:51 ` pinskia at gcc dot gnu dot org

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