PNaCl: Google Adds More Native Support to Chrome via LLVM
Google broadens support for native applications in Chrome by enabling it to run LLVM bitcode.
Google continues pushing support for running native applications in Chrome announcing the anticipated PNaCl, or Portable NaCl - read as ‘pinnacle’, during Google I/O 2013. PNaCl introduces a twist in the toolchain: instead of compiling C/C++ applications for each of the hardware platforms targeted, developers now need to generate a single LLVM bitcode which is them loaded by any Chrome client and translated to native code, validated and executed locally.
Currently, PNaCl is supported by Chrome 29 for 32-bit x86, 64-bit x86, and ARM architectures, and clients will be able to run native modules on any web page – no need for packaging them in apps for Chrome Web Store –, when it is fully released. Also, PNaCl modules will be able to run on future architectures without recompilation. What’s more interesting is that while currently only C/C++ is supported, PNaCl modules can be theoretically written in any languages that can be compiled to LLVM bitcode, including ActionScript, Ada, D, Fortran, Haskell, Java bytecode, Objective-C, Python, Ruby, Rust, Scala and C#, broadening the spectrum of legacy and newer native applications that can be run in Chrome with minimal or no adaptation.
PNaCl was proposed internally by a team of 4 Google engineers back in 2010 (PDF), the authors envisioning a solution that would:
- Provide an ISA-neutral format for compiled NaCl modules supporting a wide variety of target platforms without recompilation from source.
- Make it easy for NaCl developers to build, test and deploy portable executable modules.
- Support the x86-32, x86-64 and ARM instruction sets initially, but make it straightforward to support other popular general-purpose CPUs in future.
- Preserve the security and performance properties of Native Client.
PNaCl still uses the original NaCl sandbox mechanism which is meant to enforce security when running translated bitcode as shown in the following graphic: