[llvm-dev] A libc in LLVM

Siva Chandra via llvm-dev llvm-dev at lists.llvm.org
Thu Jun 27 15:38:59 PDT 2019

On Thu, Jun 27, 2019 at 9:06 AM Zachary Turner <zturner at roblox.com> wrote:
> I guess let me make this concrete: can you propose a specific separation that you have in mind?
> Keep in mind that even if A doesn’t depend on B, that doesn’t mean that A and B can be separated.  You mentioned that open() and close() would obviously  have to be done at the same time, but it’s much worse than this: The *entire transitive closure* of open() and close() must be done at the same time, and my hypothesis is that this is going to a) be much larger than you expect, and b) be different with different underlying libc implementations.

Let me change the direction here a little bit. Lets say, for Windows,
you can develop the new libc starting from a clean slate without
having to worry about the redirectors/forwarders. Is that a good
enough place for you to start?

What I am getting to is this: redirectors are probably an
implementation detail at this point. We think they will allow us to
develop and phase-in this libc in a gradual manner. But, if they end
up being a problem on other platforms, we will build them in such a
way that they only stay as Linux specific implementation details. If
other platforms can benefit from them, they are of course free to
adopt them.

> Then there are more immediate issues.  On Windows specifically, I’m not even sure it’s going to be physically possible to link in two copies of the CRT and have one forward to the other.  If it is possible, it’s very non obvious how to make it work and will likely require a ton of additional machinery.

No, I do not think we want to mix up CRTs on any platform. At the
least, it will be disruptive to the compiler drivers. Our goal is to
build a CRT with supports statically linked executables on Linux. We
do not intend to mix this new CRT with the CRT from the system libc.
The new CRT might only be useful after a non-trivial part of the libc
has been built. Until then, we have to use the CRT from the system

More information about the llvm-dev mailing list