gcc 3.1 fails to bootstrap on sparc64-sun-solaris2.8

Rupert Wood me@rupey.net
Thu May 23 00:46:00 GMT 2002


Alexander Poquet wrote:

> Trying to build a 64-bit capable gcc on sparcv9.

A regular sparc-sun-solaris2.8 build will generate 64-bit code with flag
'-m64' (unless you configured '--disable-multilibs'). You don't have to
build the compiler as 64-bit.

> ld: warning: file ../libiberty/libiberty.a(hashtab.o): wrong 
> ELF class: ELFCLASS32

The problem is that the top-level libiberty was built as 32-bit. GCC
assumes, since you've told it that it's building a native compiler, that
the bootstrap compiler generates code for the target whereas in this
case the target is 64-bit but the bootstrap compiler only generates
32-bit code.

Clean out the top level libiberty directory and reconfigure and build
using the xgcc you've just built, i.e. something along the lines of:

   CC="../gcc/stage1/xgcc -B../gcc/stage1/" \
       <srcdir>/libiberty/configure <etc>
   make CC="../gcc/stage1/xgcc -B../gcc/stage1/"

Go back and restart the bootstrap; it should then complete (or, at
least, it has for me before from this situation.)

Other ways that should build sparc64:

  1. If your GCC 3.0 is multilibbed, it will understand -m64. Then:

      CC="gcc -m64" ../gcc/configure <etc> sparc64-sun-solaris2.8
      make bootstrap CC="gcc -m64"

     i.e. get the bootstrap compiler to generate 64-bit code. Note
     that GCC 3.0's 64-bit ABI support is incomplete but this will
     probably work. (It may be safer to build GCC 3.1 as
     sparc-sun-solaris2.8 and then use that with -m64 as the
     bootstrap compiler.)

  2. Generate a cross-compiler to sparc64 then use that as the build
     compiler to bootstrap a 64-bit gcc. (Don't know if you'd need a
     complete toolchain or not - never tried this.)

However, I still recommend that you build sparc-sun-solaris2.8 and use
'-m64' when necessary.

Rup.



More information about the Gcc-help mailing list