public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <iant@google.com>
To: Thomas Martitz <thomas.martitz@student.htw-berlin.de>
Cc: gcc-help@gcc.gnu.org
Subject: Re: suggestion for GCC (1)
Date: Tue, 08 Feb 2011 07:35:00 -0000	[thread overview]
Message-ID: <mcrtygftkwu.fsf@google.com> (raw)
In-Reply-To: <4D50848C.1070900@student.htw-berlin.de> (Thomas Martitz's	message of "Tue, 08 Feb 2011 00:47:24 +0100")

Thomas Martitz <thomas.martitz@student.htw-berlin.de> writes:

> Am 08.02.2011 00:04, schrieb Ian Lance Taylor:
>> ali hagigat<hagigatali@gmail.com>  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

  reply	other threads:[~2011-02-08  0:44 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-07 10:23 ali hagigat
2011-02-07 10:26 ` Kai Ruottu
2011-02-07 10:29   ` Kai Ruottu
2011-02-07 10:57     ` ali hagigat
2011-02-07 11:03     ` ali hagigat
2011-02-07 23:43 ` Ian Lance Taylor
2011-02-08  0:44   ` Thomas Martitz
2011-02-08  7:35     ` Ian Lance Taylor [this message]
2011-02-08 14:23       ` David Brown
2011-02-09  4:54         ` Ian Lance Taylor
2011-02-09  5:17 ali hagigat
2011-02-09  5:27 ` Ian Lance Taylor
2011-02-09  6:03   ` ali hagigat
2011-02-09  7:05     ` ali hagigat
2011-02-09 10:26       ` Ian Lance Taylor
2011-02-09 15:23       ` David Brown
2011-03-06 13:19         ` Enrico Weigelt
2011-02-09  7:08     ` Ian Lance Taylor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=mcrtygftkwu.fsf@google.com \
    --to=iant@google.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=thomas.martitz@student.htw-berlin.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).