Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Aug 2006 00:01:30 -0600 (MDT)
From:      "M. Warner Losh" <imp@bsdimp.com>
To:        sgk@troutmask.apl.washington.edu
Cc:        hackers@freebsd.org, mwm@mired.org
Subject:   Re: amd64 questions
Message-ID:  <20060828.000130.-1264101530.imp@bsdimp.com>
In-Reply-To: <20060826212607.GA82729@troutmask.apl.washington.edu>
References:  <20060826192418.GA82155@troutmask.apl.washington.edu> <17648.42078.268722.152591@bhuda.mired.org> <20060826212607.GA82729@troutmask.apl.washington.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
In message: <20060826212607.GA82729@troutmask.apl.washington.edu>
            Steve Kargl <sgk@troutmask.apl.washington.edu> writes:
: On Sat, Aug 26, 2006 at 03:43:26PM -0400, Mike Meyer wrote:
: > In <20060826192418.GA82155@troutmask.apl.washington.edu>, Steve Kargl <sgk@troutmask.apl.washington.edu> typed:
: >> On Sat, Aug 26, 2006 at 02:40:24PM -0400, Mike Meyer wrote:
: >>> I'm not sure what you're saying is false - that the compiler can
: >>> generate i386 binaries, or that the rest of the toolchain doesn't do
: >>> the right thing.
: >>> I can build i386 binaries with the system cc. However, if I just
: >>> specify '-m32', it dies during the link because it tries to link with
: >>> amd64 object files. I've managed to get some simple things to build by
: >>> passing the appropriate command line to cc.
: >>> Would rebuilding the compiler with multilibs fix that problem? Or does
: >>> it assume a library structure that isn't in place on FreeBSD?
: >> I believe it is a library structure problem.  You need at least
: >> a 32-bit and 64-bit libgcc.so.  When you use -m32 the compiler
: >> goes looking for an appropriate libgcc.so and only finds a 64-bit
: >> version.
: > 
: > Yup. If you tell it -L/usr/lib32 (which gets installed if you build the
: > world with WITH_LIB32 defined), it'll find that. Then complain because
: > /lib/crt1.o is the 64 bit one. If I use the command line arguments:
: > 
: > -m32 -nostartfiles /usr/lib32/crt1.o /usr/lib32/crti.o \
: > /usr/lib32/crtbegin.o /usr/lib32/crtend.o /usr/lib32/crtn.o -L/usr/lib32
: > 
: > simple programs build and run properly.
: 
: If gcc is built with multilib, it's my understanding that you 
: don't need to do all of this commandline mangling.

You also don't need it if you build gcc and binutils with a tools
prefix :-)

Warner



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060828.000130.-1264101530.imp>