What’s new in LLVM

LLVM 6 introduces Spectre exploit mitigations, improves Windows and Intel CPU support, and embraces WebAssembly as a compilation target

The LLVM compiler framework has gone from being a technological curiosity to a vital piece of the modern software landscape. It is the engine behind the Clang compiler, as well as the compilers for the Rust and Swift languages, and provides a powerful toolkit for creating new languages.

It is also a fairly fast-moving project, with major point revisions announced every six months or so. Version 6.0, released earlier this month, continues LLVM’s ongoing mission to deepen and broaden support for a variety of compilation targets. The update also adds many timely fixes to guard against recently discovered processor-level system attacks.

LLVM adds partial Spectre protection

The “Spectre” and “Meltdown” CPU exploits take advantage of speculative execution features in modern processors. Because they must be addressed by a combination of CPU microcode updates and changes to existing software, they are difficult to fix.

To ensure that applications built with LLVM can do their part to guard against such attacks, LLVM now offers support for ”retpolines,” a software construction that partly alleviates one of the varieties of the Spectre attack. To make use of it, you’ll need to use LLVM 6.0 to recompile the software in question using the -mretpoline command line switch.

LLVM CodeView debugging for Windows improved

Microsoft Windows uses debug information stored in a format called the CodeView format, analogous to the DWARF format used in Linux systems.

LLVM previously added support for working with CodeView, as part of a general push toward making LLVM a better citizen on Windows, and leveraging the wealth of debugging tools in Windows that use CodeView.

LLVM 6 further improves that support, thanks to some support from Microsoft and some diligent reverse engineering on behalf of the LLVM team. The long-term idea is to improve CodeView support to the point where LLVM-compiled languages other than C/C++ (for instance, by way of the Clang compiler) can make robust use of CodeView and its tools.

LLVM supports WebAssembly as a linking target

WebAssembly, the binary format for applications delivered in a web browser, is starting to evolve from an experiment into a production technology. Key parts of the WebAssembly toolchain, such as Emscripten and PNaCL, use LLVM.

The latest step is support in LLVM’s linker tools for WebAssembly, by way of the wasm-ld command-line tool. This tool ingests assembly created by LLVM when using the wasm32-unknown-unknown-wasm target, and emits web-ready WebAssembly binaries.

Support for WebAssembly is still necessarily incomplete, as WebAssembly itself is a work in progress, but LLVM is likely to remain a key element in the WebAssembly stack.

LLVM improvements to Intel CPU support

LLVM programs can now take advantage of instruction scheduling on many families of Intel processor: Sandy Bridge, Ivy Bridge, Haswell, Broadwell, and Skylake. The Intel Icelake CPU is now a supported target, too.

LLVM now supports emitting intrinsics that work with Intel processor extensions used for vector processing: VAES, GFNI, VPCLMULQDQ, AVX512VBMI2, AVX512BITALG, and AVX512VNNI.

Code generation has been improved overall for various operations on Intel processors, such as memory comparisons, vector truncations, and vector multiplication with 32-bit integer values.

Join the newsletter!

Or

Sign up to gain exclusive access to email subscriptions, event invitations, competitions, giveaways, and much more.

Membership is free, and your security and privacy remain protected. View our privacy policy before signing up.

Error: Please check your email address.

More about IntelLinuxMicrosoft

Show Comments
[]