On 2007-Apr-06 01:53:54 +0300, cihan <[EMAIL PROTECTED]> wrote:
>How can I convert c source code to plain binary file?

What do you mean by "plain binary"?  From the context, it looks like
you want some sort of stand-alone executable but you don't say how
you intend to run it.

>But I give linker error like a "undefined reference to putchar"

This implies that you have a reference to putchar() in foo.c - you
will need to provide an implementation of it and the implementation
will (of necessity) require knowledge of the execution environment.

>ld -Ttext 0x0 -e main -s --oformat binary -o foo.bin foo.o -lc

This won't work because libc in intended to work in an environment
hosted on FreeBSD and needs infrastructure that is part of crt*.o

Have a look in (eg) /usr/src/sys/boot/i386 for code that is intended
to run without the kernel.

-- 
Peter Jeremy

Attachment: pgpLbs2ZsAt0c.pgp
Description: PGP signature

Reply via email to