From owner-freebsd-hackers@FreeBSD.ORG Fri Apr 6 01:42:43 2007 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A4BB216A402 for ; Fri, 6 Apr 2007 01:42:43 +0000 (UTC) (envelope-from peterjeremy@optushome.com.au) Received: from turion.vk2pj.dyndns.org (c220-239-3-125.belrs4.nsw.optusnet.com.au [220.239.3.125]) by mx1.freebsd.org (Postfix) with ESMTP id 3707113C469 for ; Fri, 6 Apr 2007 01:42:43 +0000 (UTC) (envelope-from peterjeremy@optushome.com.au) Received: from turion.vk2pj.dyndns.org (localhost.vk2pj.dyndns.org [127.0.0.1]) by turion.vk2pj.dyndns.org (8.13.8/8.13.8) with ESMTP id l361gbeT070454; Fri, 6 Apr 2007 11:42:37 +1000 (EST) (envelope-from peter@turion.vk2pj.dyndns.org) Received: (from peter@localhost) by turion.vk2pj.dyndns.org (8.13.8/8.13.8/Submit) id l361gadg070453; Fri, 6 Apr 2007 11:42:36 +1000 (EST) (envelope-from peter) Date: Fri, 6 Apr 2007 11:42:36 +1000 From: Peter Jeremy To: cihan Message-ID: <20070406014236.GD842@turion.vk2pj.dyndns.org> References: <20070405225355.27230.qmail@istanbul.enderunix.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="hQiwHBbRI9kgIhsi" Content-Disposition: inline In-Reply-To: <20070405225355.27230.qmail@istanbul.enderunix.org> X-PGP-Key: http://members.optusnet.com.au/peterjeremy/pubkey.asc User-Agent: Mutt/1.5.14 (2007-02-12) Cc: freebsd-hackers@freebsd.org Subject: Re: gcc plain binary format X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2007 01:42:43 -0000 --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 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--