On Fri, 2006-10-27 at 10:38 +0200, Hans de Goede wrote:
Hi all,
"gcc -o hello helloworld.c", creates an x86_64 elf file on
my x86_64
system as expected however, "setarch i386 gcc -o hello helloworld.c"
also creates an x86_64 elf file instead of an i386 one, to get an i386
one I must do: "gcc -m32 -o hello helloworld.c".
This is unfortunate,
GCC's -m<flags> are the actual origin of multilibs
(NOTE: multilibs ==
building for architecture variants; not multiarch'ing == running
different architectures in the same run-time environment !).
because even though rpmbuild adds -m32 to the
*FLAGS environment variables things still don't for many packages,
because they for example often ignore LDFLAGS,
It is controversial if
-m<flags> should be part of CFLAGS or LDFLAGS
etc.
Some people consider it to be a mistake, because -m<flags> can comprise
effects on various components of a toolchain, not only the compiler
(E.g. there exist targets from whom -m<flags> set CPP defines).
thus not specifying -m32
when linking, causing things to fail.
Adding -m<flags> directly to CC, CXX
etc. is an alternative approach.
Ralf