This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
biarch gcc
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: gcc at gcc dot gnu dot org
- Date: Wed, 13 Aug 2003 00:28:17 +0930
- Subject: biarch gcc
Some observations on biarch gcc, with particular reference to
powerpc64-linux.
Firstly, configuring a biarch compiler is full of traps for the unwary.
Libraries and startup files will only be found if
a) You are configuring a native compiler, and have 32 bit and 64 bit
glibc installed to /lib and /lib64 respectively (or /usr/lib,
/usr/lib64 and other variations based on the standard startfile
locations).
or
b) You use a sysroot setup that effectively emulates the native setup as
in (a) but all relative to the sysroot. Binutils also must be
configured using the same --with-sysroot.
or
c) You hack config.gcc to enable biarch support on the 32 bit version of
the compiler, and create a few strategic symbolic links in the
install tree. ftp.linuxppc64.org/pub/people/amodra/gcc-3.2/bootstrap
describes the process for an i686-linux to powerpc-linux biarch
toolchain. Call me stubborn, but I wanted to prove that it was
possible without a sysroot, using familiar locations like
/usr/local/powerpc-linux/lib and /usr/local/powerpc64-linux/lib for
cross glibc installation. This can't work with biarch support on the
64 bit compiler (eg. --target=powerpc64-linux) because
MULTILIB_OSDIRNAMES is defined to find 32 bit libs using "../lib".
If you have 64 bit libs in /usr/local/powerpc64-linux/lib, then you
can't have 32 bit ones at /usr/local/powerpc64-linux/lib/../lib.
In hindsight, option (b) is probably better for cross toolchains.
Secondly, getting header files right is not so easy. Typically, some 32
bit headers are different from the corresponding 64 bit header. It's
possible to hack around this problem by creating lots of stubs that test
__powerpc64__ and then include the real header, or by using esoteric
-isystem gcc options. You also need to deal with patched headers
installed by fixincludes, which might get in the way of such hacks.
For these reasons, I propose that biarch compilers are only enabled when
--enable-biarch is given to configure. At least, thats the way I want
it for powerpc64-linux, and will follow up with a patch tomorrow.
Comments?
--
Alan Modra
IBM OzLabs - Linux Technology Centre