On Wed, Aug 24, 2011 at 01:57:02PM +0100, Tom Evans wrote:
> On Wed, Aug 24, 2011 at 12:11 PM, Michael Hoffmann <benz...@arcor.de> wrote:
> > Maybe off topic?
> >
> > 1: echo "int main(void) { return 0; }" > t.c
> >
> > 2: setenv LDEMULATION elf_i386_fbsd
> >
> > 3: gcc -c -m32 -o t.o t.c
> >
> > 4: gcc -nostartfiles -o a.out
> > t.o -L/usr/lib32 /usr/lib32/crt1.o /usr/lib32/crti.o
> >
> > 5: file a.out
> > a.out: ELF 32-bit LSB executable, Intel 80386, version 1 (FreeBSD),
> > dynamically linked (uses shared libs), for FreeBSD 8.2, not stripped
> >
> > 6: uname -m
> > amd64
> >
> > 2: q.v. info binutils -> Selecting The Target System
> >
> > Maybe there is a more comfortable way.
> > Michael
> >
> 
> You don't need to go to all that effort:
> 
> $ uname -m
> amd64
> $ echo "int main(void) { return 0; }" > t.c
> $ gcc -c -m32 -o t.o t.c
> $ gcc -m32 -o t t.o -B/usr/lib32
> $ file t
> t: ELF 32-bit LSB executable, Intel 80386, version 1 (FreeBSD),
> dynamically linked (uses shared libs), for FreeBSD 8.2 (802510), not
> stripped

Well-known problem is that /usr/include/machine/*.h still contains
amd64 arch definitions. The resulting binary is broken in the quite
subtle ways.

Attachment: pgp1knQx89Ipg.pgp
Description: PGP signature

Reply via email to