[llvm-dev] A libc in LLVM

JF Bastien via llvm-dev llvm-dev at lists.llvm.org
Fri Jun 28 09:29:40 PDT 2019

I think I now understand some of the disconnect you and I are having, and I think some of the pushback you’re getting from the community is the same. You’re talking about where you want to start with an LLVM libc. Many in the community (myself included) want to understand where we’ll get with this libc. At steady-state, what does it do? To a certain degree I don’t care about how you get to the steady state: sure the implementation approach is important, and which contributor cares about what parts is important in shaping that evolution, but at the end of the day what matters is where you get.

So here’s what’s missing: there’s no goal. Right now, your proposal is “let’s do an LLVM libc, starting with what I care about, who’s interested?”

That’s an OK place to start! You illustrated your needs, others chimed in with theirs, and now you know there’s some interest. However, you should take time now to come up with a plan. What’s this libc actually going to be? I ask a bunch of questions below that I think you need to answer as a next step. Others asked more questions which I didn’t echo, but which you should answer as well. What does this libc aspire to become?

More below:

> On Jun 27, 2019, at 10:29 PM, Siva Chandra <sivachandra at google.com> wrote:
> On Thu, Jun 27, 2019 at 5:19 PM JF Bastien <jfbastien at apple.com <mailto:jfbastien at apple.com>> wrote:
>> 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 was of the opinion that you were asking me to elaborate point #3 of
> mine from above.

I indeed was. I’d like a list of C / POSIX standards the library will try to conform to.

e.g. libc++ only really implements C++11 and later standards, some libstdc++ compatibility extensions, some experimental stuff from TSes, and a handful of other things. What’s your list?

>> 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.
> I want to refrain from talking as if this libc project has already
> been accepted by the LLVM. But yes, if this libc project is indeed
> accepted and takes off, we will definitely want a charter written down
> for this as an LLVM project. And I also agree that this charter cannot
> limit itself to Google's use cases.

You want a charter, before the project is accepted.

>> Compare with libc++: https://libcxx.llvm.org <https://libcxx.llvm.org/>
> Yes. Our aspirations for this libc are to be like libc++.
>> 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.
> Absolutely!
>> Same as above, IMO an LLVM project should aspire to something bigger, even if practical concerns guide the initial implementation.
> Again, I want to wait for some sort of confirmation that we can
> actually start work on this as an LLVM project.

You have enough tentative support and interested contributors to warrant writing down a plan.

>> 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.
> I do not disagree. At the same time, I am of the opinion that such a
> champion should grow out of this project rather than getting
> volunteered or nominated. This is my personal opinion and I am ready
> to be corrected.

Having this kind of champion is really important for an LLVM libc. I’m not sure I’d support such a project without such a person. As you come up with a plan, consider who that should be. Maybe it’s you :-)

>> I think you need write a design for how this C library will be tested.
> I can assure you that all this will happen once we take off.

You want a plan before it takes off. Testing standardized stuff has enough precedent that you should be able to look at what others have done, and come up with a plan up front. I really like that you want to fuzz, use sanitizers, etc. That’s pretty novel for this kind of project. Basic standards testing isn’t novel, so it should be pretty easy to figure out.

>> 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.
> Experienced guidance is most welcome. And, thanks a lot for bringing
> up everything you have done in this email. I also apologize for the
> delay in my response, so thanks for your patience as well.

No worries! You’ve got a lot of responses, and that’s good.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190628/7634af7e/attachment.html>

More information about the llvm-dev mailing list