[llvm-dev] A libc in LLVM

JF Bastien via llvm-dev llvm-dev at lists.llvm.org
Thu Jun 27 17:19:28 PDT 2019


> On Jun 27, 2019, at 5:05 PM, Siva Chandra <sivachandra at google.com> wrote:
> 
> On Wed, Jun 26, 2019 at 10:27 AM JF Bastien <jfbastien at apple.com> wrote:
>>> 3. If there is a specification, we should follow it. The scope that we need includes most of the C Standard Library; POSIX additions; and some necessary, system-specific extensions. This does not mean we should (or can) follow the entire specification -- there will be some parts which simply aren't worth implementing, and some parts which cannot be safely used in modern coding practice.
> 
>> I’d love to hear what you have in mind with point 3 above, and see it expanded. libc++ implements C++11 and subsequent standards, and that makes me wonder:
>> 
>> Which standards would this libc implement?
> 
> We need parts of the C standard library, parts of the POSIX
> extensions, and also the linux headers. The community is of course
> free to widen the surface as needed.

Which standard specifically? So far the responses sound like “the standard Google uses”. I don’t think that's a good objective for such a project. For practical purposes that’s the implementation approach that makes sense to start with, but I’m looking for what the charter of this LLVM project should be.

Compare with libc++: https://libcxx.llvm.org <https://libcxx.llvm.org/>
I think you want to fill out a proposed set of documentation pages, like libc++’s, and answer the questions libc++ answers. Not where you’ll start or in what order (though that’s useful for this discussion!), but what your proposed libc aspires to be.


>> Would you implement upcoming C standards, and how would you manage “experimental” features (API changes, ABI changes, etc)?
> 
> We will probably take this up on an as-needed basis.

Same as above, IMO an LLVM project should aspire to something bigger, even if practical concerns guide the initial implementation.


>> What parts of the standard wouldn’t you follow, why, how would the LLVM community determine this?
> 
> I would think what we (the "we" here is for the developer community
> and not my company or my team) communicate would depend on how the
> project evolves. For example, at the very beginning, we will probably
> only say "large parts of the standards A, B, C are still
> unimplemented." When the implemented surface becomes large enough, we
> might start explicitly listing the unimplemented parts. There might be
> parts which require qualification with version numbers.
> 
>> Which parts aren’t worth implementing?
>> Which parts cannot be safely used in modern coding practice? How would you remedy what’s perceived as “the bad parts”?
> 
> At a certain level, what is worth and what is safe/unsafe is a
> subjective matter. So, instead of listing my opinions here, let me say
> this: If we build sufficient modularity into the libc, one will be
> able to pick and choose what they want, and omit what they do not
> want.
> 
>> I’d love it if the C Standards Committee, WG14, got renewed involvement through this project. Is that an explicit goal? Who will join WG14 in this effort?
>> What part of C do you see this project help improve over time?
> 
> The answer to this question also depends on how the project and the
> community around it evolves.

Personally I’m really interested in a project that increases the quality of all C libraries, and of the C standard. I therefore think champions of this project signing up to collaborate with WG14 is important.


>> How do you intend to test this C library? Fuzzing and all that is nice, but just straight conformance testing is what I’d like to hear about.
> 
> What kind of testing we want to do depends on what exactly is getting
> tested. But in general, we want to do conformance tests for sure. We
> also want to do some amount of differential testing between this new
> libc and an existing, battle tested libc. Depending on what is getting
> tested, we also want to be able to test against the test suite of an
> existing libc.

I think again, it’s useful to look at libc++ here, and see its testing strategy. It tests against multiple standards, calling out what it’s testing exactly, and it also tests extensions and other non-standard things, calling out when it does so. This allows, for example, the Microsoft STL implementors to use the libc++ test suite.

I think you need write a design for how this C library will be tested.


I suggest you have a chat with Marshall Clow (CC’ed). He does a lot of really good work with libc++ and the C++ Standards Committee. I’d like this C library to be similar to libc++ in many ways, and I’d like a leader like Marshall involved in leading this C library. Talking to Marshall will help understand the type of leadership I’d like to see in this project.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190627/8c2c5103/attachment.html>


More information about the llvm-dev mailing list