Eric wrote:
> Any pointers at all as to the error of my ways ?
http://gcc.gnu.org/install/specific.html#sparc64-x-solaris2
You're up against three factors here. First, the sparc64 platform ABI
specifies 32-bit executables unless the user specifically asks for
64-bit. I'm really unclear on why you think that's a bad thing (spacv9
gives all the benefits of 64-bit, including 64-bit regs, but without the
space blow-up that comes from 64-bit pointers). It's useful enough that
the x86 world is replicating it with x32. However, if you're really
determined to have 64-bit only,
CC='cc -m64' and CXX='CC -m64' ./configure --build=sparc64-sun-solaris2.10
usually does the trick (you didn't mention which compiler you're using
to bootstrap, I assume suncc). You'll want to do that with gmp/mpfr/mpc
as well, because gcc is pretty picky that they have *exactly* the same
target triple.
Another issue is preventing gcc from attempting a 32-bit multilib, since
it wants to be able to generate both 32- and 64-bit code (as per the
platform ABI). Passing --disable-multilib takes care of that.
The last (very annoying) issue is that when gcc bootstraps itself, the
freshly-built compiler doesn't generate 64-bit binaries by default.
BOOT_CFLAGS can work around that: http://gcc.gnu.org/install/build.html.
CC='cc -m64' CXX='CC -m64' ../gmp-5.0.1-src/configure
--prefix=$HOME/apps/gcc-4.7.2 --build=sparc64-sun-solaris2.10
--disable-shared
CC='cc -m64' CXX='CC -m64' ../mpfr-3.1.1-src/configure
--prefix=$HOME/apps/gcc-4.7.2 --build=sparc64-sun-solaris2.10
--disable-shared --with-gmp=$HOME/apps/gcc-4.7.2
CC='cc -m64' CXX='CC -m64' ../mpc-0.8.2-src/configure
--prefix=$HOME/apps/gcc-4.7.2 --build=sparc64-sun-solaris2.10
--disable-shared --with-{gmp,mpfr}=$HOME/apps/gcc-4.7.2
CC='cc -m64' CXX='CC -m64' ../gcc-4.7.2-src/configure
--prefix=$HOME/apps/gcc-4.7.2 --build=sparc64-sun-solaris2.10
--disable-multilib --with-{gmp,mpfr,mpc}=$HOME/apps/gcc-4.7.2
--without-gnu-{as,ld}
make {CFLAGS_FOR_TARGET,BOOT_CFLAGS}='-m64 -O2'
$ file $HOME/apps/gcc-4.7.2/bin/gcc
gcc: ELF 64-bit MSB executable SPARCV9 Version 1, dynamically linked,
not stripped, no debugging information available
$ $HOME/apps/gcc-4.7.2/bin/gcc hello.c
$ file ./a.out
a.out: ELF 64-bit MSB executable SPARCV9 Version 1, dynamically
linked, not stripped, no debugging information available
Notes:
- Use mpfr-3.1.1 or newer, older versions are broken on sparc-solaris
(linker errors involving alloca)
- Build the support libs with --disable-shared to avoid strange
TLS-related loader errors
- Disable -g to avoid linker errors mentioning R_SPARC_UA32 and
.rela.debug_info during stage 3
Ryan