Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Apr 2007 11:42:36 +1000
From:      Peter Jeremy <peterjeremy@optushome.com.au>
To:        cihan <cihan@edu.enderunix.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: gcc plain binary format
Message-ID:  <20070406014236.GD842@turion.vk2pj.dyndns.org>
In-Reply-To: <20070405225355.27230.qmail@istanbul.enderunix.org>
References:  <20070405225355.27230.qmail@istanbul.enderunix.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--hQiwHBbRI9kgIhsi
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On 2007-Apr-06 01:53:54 +0300, cihan <cihan@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.

--=20
Peter Jeremy

--hQiwHBbRI9kgIhsi
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (FreeBSD)

iD8DBQFGFaWM/opHv/APuIcRAvgKAJ9/KkrEpAi+M7FN68pRZei4I07FqQCbBGED
rl9vYKzmxquefLALKjduGBs=
=iQyt
-----END PGP SIGNATURE-----

--hQiwHBbRI9kgIhsi--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070406014236.GD842>