This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
How does one get gcc to default to 64 bit executables?
- From: Dan Kegel <dank at kegel dot com>
- To: GCC Mailing List <gcc at gcc dot gnu dot org>, vanl at megsinet dot net
- Date: Sat, 01 May 2004 13:39:45 -0700
- Subject: How does one get gcc to default to 64 bit executables?
I'm having a bit of trouble configuring gcc-3.4.0 for sparc64-linux.
The resulting compiler defaults to sparc32, which is a problem
because it means having to figure out how to add
-mcpu=ultrasparc3 -Wa,-Av9a -m64 to CFLAGS for everything I build.
The worst part is that this even affects libgcc.a, which makes it
pretty hard to link any sparc64 executables. I could figure out
how mklibgcc and multilibbing work, and maybe thereby get a good 64 bit libgcc.a,
but I'd kind of like to avoid that for the moment, and just really get
gcc to default to 64 bit output.
What's the right way to get gcc to default to building 64 bit executables
when targeting sparc64-linux?
Here's how I configure the bootstrap gcc:
../gcc-3.4.0/configure \
--target=sparc64-unknown-linux-gnu \
--host=i686-host_pc-linux-gnu \
--disable-multilib --with-newlib --disable-multilib --with-cpu=ultrasparc3 \
--without-headers --disable-nls --enable-threads=no --enable-symvers=gnu \
--enable-__cxa_atexit --enable-languages=c --disable-shared \
--prefix=/opt/crosstool/sparc64-unknown-linux-gnu/gcc-3.4.0-glibc-2.3.2 \
--with-local-prefix=/opt/crosstool/sparc64-unknown-linux-gnu/gcc-3.4.0-glibc-2.3.2/sparc64-unknown-linux-gnu
(I'm not using --with-sysroot. I wonder if that would magically help... it
seems to be required to get a working x86_64 toolchain...)
Stop reading here unless you want the gory details.
Thanks,
Dan
I then configure glibc like this (note the obsessive use of -mcpu=ultrasparc3 -m64;
I'd like to not have to sprinkle this everywhere like that):
BUILD_CC=gcc \
CFLAGS="-O -mcpu=ultrasparc3 -Wa,-Av9a -m64" \
CC="sparc64-unknown-linux-gnu-gcc -mcpu=ultrasparc3 -Wa,-Av9a -m64" \
AR=sparc64-unknown-linux-gnu-ar \
RANLIB=sparc64-unknown-linux-gnu-ranlib \
../glibc-2.3.2/configure --host=sparc64-unknown-linux-gnu --prefix=/usr --build=i686-host_pc-linux-gnu --without-tls --without-__thread --enable-kernel=2.4.3 --without-cvs --disable-profile --disable-debug --without-gd --enable-add-ons
--with-headers=/opt/crosstool/sparc64-unknown-linux-gnu/gcc-3.4.0-glibc-2.3.2/sparc64-unknown-linux-gnu/include
And the problem I hit is
sparc64-unknown-linux-gnu-gcc -mcpu=ultrasparc3 -Wa,-Av9a -m64 -nostdlib -nostartfiles -r -o /home/dank/wk/crosstool-0.28-rc9/build/sparc64-unknown-linux-gnu/gcc-3.4.0-glibc-2.3.2/build-glibc/elf/librtld.map.o '-Wl,-('
/home/dank/wk/crosstool-0.28-rc9/build/sparc64-unknown-linux-gnu/gcc-3.4.0-glibc-2.3.2/build-glibc/elf/dl-allobjs.os /home/dank/wk/crosstool-0.28-rc9/build/sparc64-unknown-linux-gnu/gcc-3.4.0-glibc-2.3.2/build-glibc/libc_pic.a -lgcc
'-Wl,-)' -Wl,-Map,/home/dank/wk/crosstool-0.28-rc9/build/sparc64-unknown-linux-gnu/gcc-3.4.0-glibc-2.3.2/build-glibc/elf/librtld.mapT
/opt/crosstool/sparc64-unknown-linux-gnu/gcc-3.4.0-glibc-2.3.2/lib/gcc/sparc64-unknown-linux-gnu/3.4.0/../../../../sparc64-unknown-linux-gnu/bin/ld: skipping incompatible
/opt/crosstool/sparc64-unknown-linux-gnu/gcc-3.4.0-glibc-2.3.2/lib/gcc/sparc64-unknown-linux-gnu/3.4.0/./libgcc.a when searching for -lgcc
/opt/crosstool/sparc64-unknown-linux-gnu/gcc-3.4.0-glibc-2.3.2/lib/gcc/sparc64-unknown-linux-gnu/3.4.0/../../../../sparc64-unknown-linux-gnu/bin/ld: skipping incompatible
/opt/crosstool/sparc64-unknown-linux-gnu/gcc-3.4.0-glibc-2.3.2/lib/gcc/sparc64-unknown-linux-gnu/3.4.0/libgcc.a when searching for -lgcc
/opt/crosstool/sparc64-unknown-linux-gnu/gcc-3.4.0-glibc-2.3.2/lib/gcc/sparc64-unknown-linux-gnu/3.4.0/../../../../sparc64-unknown-linux-gnu/bin/ld: cannot find -lgcc
collect2: ld returned 1 exit status
make[2]: *** [/home/dank/wk/crosstool-0.28-rc9/build/sparc64-unknown-linux-gnu/gcc-3.4.0-glibc-2.3.2/build-glibc/elf/librtld.map] Error 1
My full build log is at http://kegel.com/crosstool/sparc64.txt.gz if that helps.
Here are the steps to repeat the problem:
wget http://kegel.com/crosstool/crosstool-0.28-rc9.tar.gz
tar -xzvf crosstool-0.28-rc9.tar.gz
sudo mkdir -p /opt/crosstool
sudo chown $USER /opt/crosstool
sh demo-sparc64.sh > log 2>&1
- Dan
--
My technical stuff: http://kegel.com
My politics: see http://www.misleader.org for examples of why I'm for regime change