Re: Minimum requirements for a custom libc

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

 



On Sat, 2025-03-15 at 15:18 +0000, Johannes Krottmayer via Gcc-help wrote:
> Dear GCC community!
> 
> I have started a custom libc implementation for the purpose of
> education.
> 
> What are the minimum requirements for the library (functions,
> headers, ...) which one *must* be implemented so GCC can use this 
> library as default?

GCC is used to compile code without any libc. The Linux kernel (see
https://kernel.org/ ...) is a typical example. And (in France, with comments in
French, but open source) so is https://github.com/Recovid/Controller

Some companies are using GCC to compile proprietary critical software. Airbus
does. https://en.wikipedia.org/wiki/Airbus EdF does.
https://en.wikipedia.org/wiki/EdF and CEA also https://www.cea.fr/ (I worked
almost 40 years there). 

GCC is designed to be able to work as a cross-compiler (even a canadian cross-
compiler).

Look also into https://compcert.org/ (a certified C compiler, the source is
available for reading, but any commercial usage requires a license sold by
https://www.absint.com/ ...)



If your question is what part of the libc does GCC uses internally, you could
patch it to link its cc1 statically. But GCC also depends on external programs
(GNU binutils ie assembler and linker) which are using other parts of libc.

Some light libc do exist, e.g. https://www.fefe.de/dietlibc/

Actually I don't understand your question. I would think that the simplest
approach is to start with an empty libc and add functions inside it.

Look also inside https://musl.libc.org/

Regards.
-- 
Basile STARYNKEVITCH                            <basile@xxxxxxxxxxxxxxxxx>
8 rue de la Faïencerie                       http://starynkevitch.net/Basile/  
92340 Bourg-la-Reine                         https://github.com/bstarynk
France                                https://github.com/RefPerSys/RefPerSys




[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