Enlarge / The LLVM dragon emblem, in honor of the dragon e book.

Google’s Chrome browser is now constructed utilizing the Clang compiler on Home windows. Beforehand constructed utilizing the Microsoft C++ compiler, Google is now utilizing the identical compiler for Home windows, macOS, Linux, and Android, and the swap makes Chrome arguably the primary main software program undertaking to make use of Clang on Home windows.

Chrome on macOS and Linux has lengthy been constructed utilizing the Clang compiler and the LLVM toolchain. The open-source compiler is the compiler of selection on macOS, making it the pure choice there, and it is also a first-class selection for Linux; although the venerable GCC remains to be the first compiler selection on Linux, by utilizing Clang as an alternative, Google ensured that it has just one set of compiler quirks and oddities to work with fairly than two.

However Chrome on Home windows has as an alternative used Microsoft’s Visible C++ compiler. The Visible C++ compiler is the best-supported, most generally used compiler on Home windows and, critically, is the compiler with the most effective help for Home windows’ big selection of debugging and diagnostic instruments. The Visible Studio debugger is extensively cherished by the C++ neighborhood, and different instruments, such because the WinDbg debugger (usually used for analyzing crash dumps), are core components of the Home windows developer expertise.

Manner again in 2013, Google determined that it needed to make use of Clang all over the place, together with Home windows. Utilizing the identical compiler all over the place makes improvement a lot simpler—you could have the identical set of bugs to take care of on each platform—and Clang particularly has diagnostic instruments corresponding to ASan and UBSan that Google needed to have the ability to use.

There was only one small sticking level: Clang and LLVM did not actually have a lot in the best way of Home windows help. This was true in superficial methods—Clang helps completely different command-line choices to Microsoft’s compiler, for instance, so could not work as a drop-in substitute—and in lots of deeper methods. For instance, Home windows’ tooling is all constructed across the PDB (“program database”) file format for holding debug info. Microsoft’s debuggers and a variety of third-party instruments all assume that Home windows applications can have their debug knowledge accessible as PDB recordsdata. LLVM, nevertheless, could not produce PDBs. As with virtually any massive software program undertaking, the Home windows APIs additionally require sure non-standard extensions, which Clang needed to be altered to help.

As such, step one to creating Chrome use Clang on Home windows was to enhance Clang and LLVM to offer them first-class help for Home windows. Google assembled a staff to work on this. The browser was first efficiently constructed with Clang on Home windows in 2015, with Google testing it first in its Canary improvement channel, then the Improvement and Beta channels. With Chrome 64, the secure browser channel is making the swap to utilizing Clang.

Whereas Google did the lion’s share of the compiler improvement to make this occur, a number of the obligatory work was achieved by Microsoft. The PDB format was largely undocumented (and the documentation that existed was very stale), so LLVM builders requested for assist: Microsoft responded by publishing a giant chunk of supply used to provide PDBs. Microsoft has additionally labored to make sure that each the Home windows headers and the C++ libraries work with Clang in addition to its personal compiler.

Google has not but moved totally to the LLVM toolchain. Chrome for Home windows nonetheless makes use of the Microsoft linker (the a part of the toolchain that mixes the compiled supply code right into a single executable or DLL), and it nonetheless makes use of the Microsoft C++ library. In time, Google plans to change to the LLVM linker and should use Clang C++ library, too.


Please enter your comment!
Please enter your name here