What standard C library does Clang use? glibc, its own, or some other one?

hippietrail picture hippietrail · Nov 24, 2019 · Viewed 7.6k times · Source

I'm pretty sure glibc is the name of the standard C library implementation for gcc.

But for LLVM/Clang I'm not sure. I've Googled to try to find if it comes with its own implementation of the whole standard C library, or whether they also use glibc. Surprisingly, all I can find is a recent article discussing that Google is considering writing a new libc for LLVM. But not what that would replace.

Even in the LLVM/Clang source repository, there's a good chance I'm just blind or stupid, but I can't seem to find it.

Just to be clear I'm only interested in the C standard library, not the C++ standard library. I'm particularly interested in poring over their implementation of the printf family of functions.

Can somebody show me where to look for Clang's libc/standard C library implementation or its source repo?

Answer

hippietrail picture hippietrail · Nov 24, 2019

Clang does not come with its own C standard library. Rather, it "supports a wide variety of C standard library implementations".

Unix-like systems including Mac OS ship with their own. Windows does not. On Windows the default arrangement requires Microsoft's Visual C libraries to be installed. It seems that it's also possible to use Clang on Windows with MinGW's libraries though.