Alongside bringing better touch support and automatic ad-blocking for 'intrusive' ads to the desktop version of Chrome, Google is also making some changes to its browser under the hood. The company is now starting to build Chrome for Windows using the Clang compiler which it already uses for other platforms like macOS and Linux.
Chrome for Windows was previously built using Microsoft's Visual C++ compiler, which is naturally the most popular compiler on the Windows platform and is most compatible with debugging and diagnostic tools for the operating system.
However, the company has been planning the move to Clang for many years now, as the open-source C++ compiler is arguably already the platform of choice on macOS and is also used by Chrome on Linux. By moving over to Clang on last major operating system not already using it, Google can now deal with bugs relating to the compiler universally, saving a lot of time and effort. Diagnostic tools such as ASan and UBSan also made Clang a more appealing choice for Google.
Google had initially made up its mind on the exodus all the way back in 2013 but was unable to do so until the release of Chrome 64 recently due to the fact that Clang had very little support on Windows. For example, the LLVM toolset that Clang is the result of cannot produce the PDB files that are required for the majority of debugging tools on Windows.
Undeterred by this lack of support, Google set out to bring Clang on parity with its Microsoft-made alternative by itself, creating a dedicated team with the task of improving Clang and LLVM compatibility in mind. An early prototype of a Clang-compiled Chrome browser was already functional in 2015, but was only made available to the general public with Chrome 64 after extensive testing on the Canary, Development and Beta channels.
Microsoft also chimed in with a bit of help, releasing large sections of code relating to the creation of PDBs, which were largely undocumented prior to this. It also made sure that Windows headers and its own C++ library worked with Clang.
Despite moving to the Clang compiler, Google had also benefited from the changes by Microsoft; for example, Chrome is still able to use the Microsoft C++ library due to Microsoft's work. It also currently uses the Microsoft linker, though Google may also ditch these for the LLVM linker and Clang's own C++ libraries in the future.
Source: LLVM Project via Ars Technica
23 Comments - Add comment