From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20160 invoked by alias); 29 Jan 2008 01:36:35 -0000 Received: (qmail 20150 invoked by uid 22791); 29 Jan 2008 01:36:35 -0000 X-Spam-Check-By: sourceware.org Received: from gatekeeper.tait.co.nz (HELO gatekeeper.tait.co.nz) (202.37.96.11) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 29 Jan 2008 01:36:17 +0000 Received: from gatekeeper.tait.co.nz (localhost.localdomain [127.0.0.1]) by localhost.tait.co.nz (Postfix) with ESMTP id EB1AC46755 for ; Tue, 29 Jan 2008 14:36:14 +1300 (NZDT) Received: from sunstrike.tait.co.nz (sunstrike [172.25.40.92])by gatekeeper.tait.co.nz (Postfix) with ESMTP id D73C146752for ; Tue, 29 Jan 2008 14:36:14 +1300 (NZDT) Received: from conversion-daemon.sunstrike.tait.co.nz by sunstrike.tait.co.nz(Sun Java System Messaging Server 6.1 (built Apr 28 2004))id <0JVD00201QZW8P00@sunstrike.tait.co.nz>(original mail from john.carter@tait.co.nz) for gcc-help@gcc.gnu.org; Tue,29 Jan 2008 14:36:13 +1300 (NZDT) Received: from parore.tait.co.nz ([172.25.140.12])by sunstrike.tait.co.nz (Sun Java System Messaging Server 6.1 (built Apr 282004)) with ESMTP id <0JVD00LZYTSDNF90@sunstrike.tait.co.nz>; Tue,29 Jan 2008 14:36:13 +1300 (NZDT) Received: from localhost ([127.0.0.1]) by parore.tait.co.nz with esmtp(Exim 4.67) (envelope-from ) id 1JJfOX-0002Ol-GY; Tue,29 Jan 2008 14:36:13 +1300 Date: Tue, 29 Jan 2008 14:22:00 -0000 From: John Carter Subject: Re: Tiny GCC: Pure, Unadulterated, Object Code In-reply-to: To: Michael Witten Cc: gcc-help@gcc.gnu.org Message-id: MIME-version: 1.0 X-Mailer: Pidgeon Post Content-type: TEXT/PLAIN; format=flowed; charset=US-ASCII Content-transfer-encoding: 7BIT X-Apparently-From: mars X-Contents: May contain traces of nuts. References: X-imss-version: 2.049 X-imss-result: Passed X-imss-approveListMatch: *@tait.co.nz X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2008-01/txt/msg00308.txt.bz2 On Wed, 23 Jan 2008, Michael Witten wrote: > These cross-compilers don't need access to any kind of > libraries or headers. > > They don't need C libraries, or libstdc++, or libobjc, > or anything that has absolutely nothing to do whatsoever > with compilation. > > > Can I build gcc in this way? Build gcc with the libc that goes into the target. Compile your code with one or more of..... `-nostartfiles' Do not use the standard system startup files when linking. The standard system libraries are used normally, unless `-nostdlib' or `-nodefaultlibs' is used. `-nodefaultlibs' Do not use the standard system libraries when linking. Only the libraries you specify will be passed to the linker. The standard startup files are used normally, unless `-nostartfiles' is used. The compiler may generate calls to `memcmp', `memset', `memcpy' and `memmove'. These entries are usually resolved by entries in libc. These entry points should be supplied through some other mechanism when this option is specified. `-nostdlib' Do not use the standard system startup files or libraries when linking. No startup files and only the libraries you specify will be passed to the linker. The compiler may generate calls to `memcmp', `memset', `memcpy' and `memmove'. These entries are usually resolved by entries in libc. These entry points should be supplied through some other mechanism when this option is specified. One of the standard libraries bypassed by `-nostdlib' and `-nodefaultlibs' is `libgcc.a', a library of internal subroutines that GCC uses to overcome shortcomings of particular machines, or special needs for some languages. (*Note Interfacing to GCC Output: (gccint)Interface, for more discussion of `libgcc.a'.) In most cases, you need `libgcc.a' even when you want to avoid other standard libraries. In other words, when you specify `-nostdlib' or `-nodefaultlibs' you should usually specify `-lgcc' as well. This ensures that you have no unresolved references to internal GCC library subroutines. (For example, `__main', used to ensure C++ constructors will be called; *note `collect2': (gccint)Collect2.) John Carter Phone : (64)(3) 358 6639 Tait Electronics Fax : (64)(3) 359 4632 PO Box 1645 Christchurch Email : john.carter@tait.co.nz New Zealand