Skip to content

Archive Layout ​

What an unpacked toolchain archive holds: the toolchain directory, $XCLANG in these docs. Every host archive holds every sysroot; the archives differ only in bin/ (its programs, and the config files of the macOS and MSVC targets, which depend on the host) and in the license notices of what the programs link. Why it is laid out this way is in toolchain structure.

xclang/
  bin/                     llvm and its names (clang, clang++, clang-cl,
                           clang-scan-deps, ld.lld, ld64.lld, lld-link,
                           llvm-ar, llvm-objcopy, windres, dsymutil,
                           llvm-gsymutil, ...), the tools outside it
                           (llvm-profdata, llvm-cov, llvm-dwarfdump,
                           llvm-strings, FileCheck), the xclang command,
                           and <target>.cfg for every spelling of every
                           target, with <target>-system.cfg beside it for
                           the platform's C++ library (-stdlib=platform),
                           and their clang-cl files, <target>-clang-cl.cfg
                           and <target>-clang-cl-system.cfg;
                           <target>-sdk.cfg and <target>-clang-cl-sdk.cfg,
                           the SDK in use of an MSVC target, which the
                           xclang command writes; on x64 Windows hosts,
                           copies of the x64 MinGW and MSVC targets' ASan
                           DLLs (Windows: ASan's DLL)
  lib/clang/<major>/       clang's resource headers, compiler-rt's headers,
                           and compiler-rt for every target; for the MSVC
                           targets libc++ too
  lib/cmake/xclang/        the CMake package
  libc++/include/c++/v1/   libc++'s headers, the same for every target
  libc++/include/<target>/c++/v1/
                           each target's own __config_site, <target> as
                           clang spells it (x86_64-w64-windows-gnu)
  libc++/src/              the runtimes' sources, the same for every target,
                           in llvm-project's layout, patched (below)
  mingw-w64/include/       mingw-w64's headers, the same for both Windows
                           targets
  share/licenses/          the license notices of everything in the archive
                           (below)
  <target>/                the sysroot of each target (below)
  sdk/                     not in the archive: the vendor SDKs that the
                           xclang command fetches, and sdk/windows,
                           sdk/macos, those in use
  LICENSE                  xclang's license

The MSVC targets have no sysroot: their C library is the fetched SDK's. Their compiler-rt and libc++ are in lib/clang/<major>/lib/windows, the directory lld-link searches by itself: libc++-<arch>.lib, libc++experimental-<arch>.lib and, for x64, libc++asan-x86_64.lib, which the target's __config_site names in every object that includes libc++ (Windows). Their <target>/ holds libc++'s module sources (share/libc++/v1), its module manifest (lib/libc++.modules.json), which -print-library-module-manifest-path does not report for them, and the ASan build's __config_site (lib/asan/include).

Sysroots ​

LinuxLinux (musl)Windows (MinGW)macOS
C libraryglibc 2.17's headers in usr/include, its startup files and libraries in lib64, usr/lib64musl 1.2.6's headers in usr/include, its startup files and libc.a in usr/lib, and its empty libm.a, libpthread.a, ...mingw-w64 (UCRT) and winpthreads: the libraries in lib, the headers in the shared mingw-w64/includenone: Apple's SDK, Xcode's, or on Linux and Windows hosts sdk/macos (macOS)
kernel headersLinux 3.10's (x64), 4.18's (arm64), in usr/includeLinux 6.18's, in usr/include
libc++, libc++abi, libunwindusr/lib; the headers in the shared libc++/include/c++/v1usr/lib; the samelib; the samelib (no libunwind: the system's, in libSystem); the same
libc++ module sourcesusr/share/libc++/v1usr/share/libc++/v1share/libc++/v1share/libc++/v1
libc++ module manifestusr/lib/libc++.modules.jsonusr/lib/libc++.modules.jsonlib/libc++.modules.jsonlib/libc++.modules.json
ASan libc++usr/lib/asannonex64: lib/asanlib/asan
GCC library namesempty libatomic.a, libgcc.a, libgcc_eh.a, libgcc_s.athe samethe same, and libssp.a, libssp_nonshared.anone

clang++ --target=<target> -print-library-module-manifest-path prints the path of the manifest.

Shared Headers ​

The headers that are the same for several targets are in the archive once, without links. libc++'s headers differ between the targets only in __config_site, which is each target's own: libc++/include is LLVM's per-target runtime layout, c++/v1 for all and <target>/c++/v1 for each. mingw-w64's headers are the same for x64 and arm64, in mingw-w64/include. The config files name the directories: -stdlib++-isystem the target's __config_site, then the shared libc++ headers; for the Windows targets -idirafter mingw-w64/include, which comes after clang's own headers, as the sysroot's include would. A build with --no-default-config that sets its own --sysroot names them too.

They are not in an include/ at the top: clang's drivers look for libc++ in <toolchain>/include/c++/v1 by themselves, the macOS one before the SDK's, so --no-default-config would find xclang's headers without a __config_site there instead of the system's.

The Runtimes' Sources ​

libc++/src holds what the runtimes of every target are built from, once: llvm-project's runtimes/, cmake/, llvm/cmake/, libcxx/, libcxxabi/, libunwind/ and compiler-rt/, without tests and documentation, and the headers of LLVM's libc that libc++ includes, with xclang's patches of them applied. The CMake package and the Bazel module build the runtimes from them (runtimes from source), LLVM's runtimes/ as from a checkout. They are 35 MB unpacked.

Licenses ​

Every archive, the toolchain, libclang, the ASan libclang and the option tables, has share/licenses:

share/licenses/
  README.md                each component: what of the archive it is, its
                           version, its license (an SPDX expression) and
                           where its source is
  sbom.spdx.json           the same as an SPDX 2.3 document
  <component>/             the component's license and notice files

The toolchain's components:

directorywhatlicense
xclangxclang's config files, CMake package and xclang commandApache-2.0
llvm-projectclang, lld, the LLVM tools, libc++, libc++abi, libunwind, compiler-rt; the files keep their paths in LLVM's source, and a <file>.license is a notice cut from that file's commentApache-2.0 WITH LLVM-exception, and the third-party parts': the regex engine, BLAKE3, xxHash, Unicode's conversions and data, the Visual Studio Setup API's declarations
zlib, zstdlinked into the programs (macOS hosts: zstd only)Zlib; BSD-3-Clause OR GPL-2.0-only
glibcthe Linux targets' C library, 2.17LGPL-2.1-or-later
muslthe musl targets' C library, 1.2.6MIT, and the parts its COPYRIGHT names: BSD-2-Clause, BSD-3-Clause, ISC, SunPro
linuxthe Linux targets' kernel UAPI headers, glibc's and musl'sGPL-2.0-only WITH Linux-syscall-note
nssthe Linux targets' libfreebl3.so, which glibc's libcrypt loadsMPL-2.0
mingw-w64the Windows targets' headers, CRT and winpthreads, which the Windows hosts' programs link tooZPL-2.1, and the runtime's other parts
rust, rust-crates/<crate>-<version>Rust's standard library and the crates bin/xclang linkseach its own

glibc, the glibc targets' kernel headers and NSS are those of CentOS 7, as conda-forge's sysroot packages repackage them: the README names those packages, CentOS's source RPMs and the upstream releases. musl and the musl targets' kernel headers are built from musl's release and kernel.org's. The libclang archives carry xclang, llvm-project, zlib and zstd (no zlib on macOS hosts, whose system has it, and mingw-w64 on Windows hosts), the option tables xclang and llvm-project.

On Linux and macOS hosts, the tool names in bin/ are symbolic links to llvm. The Windows archives hold no symbolic links, so they unpack without extra rights, and conda can package them; every tool name is a small launcher instead. The Linux sysroots hold no links either: soname links are the files themselves, and libfoo.so links are linker scripts (why glibc 2.17).