[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: x86_64 and x86 userland

From: Ralf Corsepius
Subject: Re: x86_64 and x86 userland
Date: Tue, 03 May 2005 10:15:46 +0200

On Mon, 2005-05-02 at 10:31 +0200, Ralf Wildenhues wrote:
> I have a question regarding systems with more than one ABI, specifically
> x86_64.  If you consider for example the Debian distribution which has a
> x86_64 kernel, but a completely x86 userland, config.guess still gives
> you x86_64-unknown-linux-gnu as output.  (I have been told this, but not
> tried it myself).
> Now, if you configure a package and forget to add
>   --build=i686-pc-linux-gnu
> or maybe use the setarch tool to set personality (I do not even know how
> portable/available this is -- it exists in RedHat Fedora), it may break,
> e.g. because of the __x86_64__ preprocessor define.
Well, the __x86_64__ define originates deep from inside of the

It sets it this way, because the target architecture your are compiling
for indeed is x86_64 and is not i686, because your binutils/gcc
toolchain defaults to x86_64, and because the toolchain doesn't know
anything about build/host/target tuples.

> Would it not make more sense to have config.guess return i686 instead of
> x86_64?
Definitely no.

It is your toolchain's default flags which cause your issues. The
toolchain has no knowledge about your kernel.

To work around this issue you have different options:
1. Implement i686-pc-linux-gnu-{gcc|...} wrapper scripts to invoke "gcc"
with the correct options. Then running configure scripts with 
--host=i686-pc-linux-gnu will correctly cross-compile.

2. Patch your gcc to default to -m32 instead of -m64.

3. Pass the correct CFLAGS rsp. CC to configure scripts.
e.g. configure CC="gcc -m32"


reply via email to

[Prev in Thread] Current Thread [Next in Thread]