-m32 on freeBSD 8.2r amd64

Tom Evans tevans.uk at googlemail.com
Wed Aug 24 12:57:04 UTC 2011


On Wed, Aug 24, 2011 at 12:11 PM, Michael Hoffmann <benzene at 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

Cheers

Tom


More information about the freebsd-stable mailing list