amd64 questions

M. Warner Losh imp at bsdimp.com
Mon Aug 28 06:04:24 UTC 2006


In message: <20060826212607.GA82729 at troutmask.apl.washington.edu>
            Steve Kargl <sgk at troutmask.apl.washington.edu> writes:
: On Sat, Aug 26, 2006 at 03:43:26PM -0400, Mike Meyer wrote:
: > In <20060826192418.GA82155 at troutmask.apl.washington.edu>, Steve Kargl <sgk at 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


More information about the freebsd-hackers mailing list