On Tue, Jun 26, 2012 at 2:04 PM, Alexandre Oliva <aol...@redhat.com> wrote: > I test i686-linux-gnu in a presumably unusual setting: it's an > x86_64-linux-gnu system, and I've configured the GCC build to use as > builddev tools wrapper scripts for as, ld, gnatmake and gcc that add > flags that make them default to 32-bit. > > This worked fine for regression testing, but I've recently realized > (with the PR49888/53671 mishap) that I'm getting tons of LTO testsuite > failures (before and after, so no regression), because the 32-bit LTO > plugin built in this setting can't possibly be used by the 64-bit linker > installed on the system. Obviously, passing -melf_i386 to the linker > through the wrapper is not enough for it to be able to dlopen a 32-bit > plugin ;-)
I am using this Makefile fragment to bootstrap and test -m32 and -mx32 GCC on Linux/x86-64: ifneq ($(BUILD-ARCH),$(CPU)) ifeq (i386,$(ARCH)) TARGET-FLAGS=$(TARGET) CC=gcc -m32 CXX=g++ -m32 FLAGS-TO-PASS+=CC="$(CC)" FLAGS-TO-PASS+=CXX="$(CXX)" # Need 32bit linker for LTO. */ PATH:=/usr/local32/bin:$(PATH) endif ifeq (x32,$(ARCH)) CC=gcc -mx32 CXX=g++ -mx32 FLAGS-TO-PASS+=CC="$(CC)" FLAGS-TO-PASS+=CXX="$(CXX)" # Need x32 linker for LTO. */ PATH:=/usr/localx32/bin:$(PATH) endif endif [hjl@gnu-32 gcc-32bit]$ file /usr/localx32/bin/ld /usr/localx32/bin/ld: ELF 32-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.38, BuildID[sha1]=0x85a2821594e122d4fc60741e2664c2b57888682e, not stripped [hjl@gnu-32 gcc-32bit]$ file /usr/local32/bin/ld /usr/local32/bin/ld: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped [hjl@gnu-32 gcc-32bit]$ -- H.J.