From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4916 invoked by alias); 8 Feb 2011 00:44:41 -0000 Received: (qmail 4908 invoked by uid 22791); 8 Feb 2011 00:44:41 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,TW_CP,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (74.125.121.67) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 08 Feb 2011 00:44:36 +0000 Received: from hpaq1.eem.corp.google.com (hpaq1.eem.corp.google.com [172.25.149.1]) by smtp-out.google.com with ESMTP id p180iYMN015288 for ; Mon, 7 Feb 2011 16:44:34 -0800 Received: from iwc10 (iwc10.prod.google.com [10.241.65.138]) by hpaq1.eem.corp.google.com with ESMTP id p180i2DD020871 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NOT) for ; Mon, 7 Feb 2011 16:44:31 -0800 Received: by iwc10 with SMTP id 10so5471182iwc.18 for ; Mon, 07 Feb 2011 16:44:21 -0800 (PST) Received: by 10.42.230.200 with SMTP id jn8mr19216244icb.518.1297125861191; Mon, 07 Feb 2011 16:44:21 -0800 (PST) Received: from coign.google.com ([216.239.45.130]) by mx.google.com with ESMTPS id 8sm4234550iba.10.2011.02.07.16.44.19 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 07 Feb 2011 16:44:20 -0800 (PST) From: Ian Lance Taylor To: Thomas Martitz Cc: gcc-help@gcc.gnu.org Subject: Re: suggestion for GCC (1) References: <4D50848C.1070900@student.htw-berlin.de> Date: Tue, 08 Feb 2011 07:35:00 -0000 In-Reply-To: <4D50848C.1070900@student.htw-berlin.de> (Thomas Martitz's message of "Tue, 08 Feb 2011 00:47:24 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-System-Of-Record: true 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: 2011-02/txt/msg00151.txt.bz2 Thomas Martitz writes: > Am 08.02.2011 00:04, schrieb Ian Lance Taylor: >> ali hagigat writes: >> >>> A necessary feature for GCC is to compile C/Assembly programs without >>> standard libraries for Intel architectures. >> This feature can not and will not be implemented. Some supporting >> routines are always required, particularly for gcc extensions like >> nested functions and __attribute__ ((cleanup)). > > IIRC the functions Ali mentioned (mem*) are the only required ones to > build working binaries without C library (i.e. for bare metal > targets). We do it this way at Rockbox. > > But I wonder why, the mem* functions are trivial to implement in plain > C so why does one need to provide them? I took ali to be asking to build without any libraries at all, including libgcc, which is what you get when you use -nostdlib. That can't work. I think you are talking about the case where we do use libgcc, but don't use libc. In other words: why don't we provide memcpy, etc., in libgcc, or, rather, just call libgcc-specific routines? The answer is that we expect the library provider to have a highly optimized version of those functions. That is certainly the case when using glibc on GNU/Linux. Since the library provider should already have a highly optimized version, gcc doesn't bother providing one itself. Of course we could still arrange to provide simple versions in some additional library which is only linked after libc. I would not be opposed to that. Real C programs, though, almost always call memcpy and friends themselves, and real C programs always require some level of supporting code. The current situation doesn't really bother me. Ian