Re: suggestion for GCC (1)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thomas Martitz <thomas.martitz@xxxxxxxxxxxxxxxxxxxxx> writes:

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


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux