gcc plain binary format
Peter Jeremy
peterjeremy at optushome.com.au
Fri Apr 6 01:42:43 UTC 2007
On 2007-Apr-06 01:53:54 +0300, cihan <cihan at edu.enderunix.org> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20070406/0d21f4f0/attachment.pgp
More information about the freebsd-hackers
mailing list