7 .. contents:: Table Of Contents
15 This document describes how to build Native Client modules. It is intended for
16 developers who have experience writing, compiling, and linking C and C++ code.
17 If you haven't read the Native Client :doc:`Technical Overview
18 <../../overview>` and :doc:`Tutorial <../tutorial/index>`, we recommend starting
21 .. _target_architectures:
26 Portable Native Client (PNaCl) modules are written in C or C++ and compiled
27 into an executable file ending in a **.pexe** extension using the PNaCl
28 toolchain in the Native Client SDK. Chrome can load **pexe** files
29 embedded in web pages and execute them as part of a web application.
31 As explained in the Technical Overview, PNaCl modules are
32 operating-system-independent **and** processor-independent. The same **pexe**
33 will run on Windows, Mac OS X, Linux, and ChromeOS and it will run on x86-32,
34 x86-64, ARM and MIPS processors.
36 Native Client also supports architecture-specific **nexe** files.
37 These **nexe** files are **also** operating-system-independent,
38 but they are **not** processor-independent. To support a wide variety of
39 devices you must compile separate versions of your Native Client module
40 for different processors on end-user machines. A
41 :ref:`manifest file <application_files>` will then specify which version
42 of the module to load based on the end-user's architecture. The SDK
43 includes a script for generating manifest files called ``create_nmf.py``. This
44 script is located in the ``pepper_<version>/tools/`` directory, meaning under
45 your installed pepper bundle. For examples of how to compile modules for
46 multiple target architectures and how to generate manifest files, see the
47 Makefiles included with the SDK examples.
49 This section will mostly cover PNaCl, but also describes how to build
50 **nexe** applications.
55 The PNaCl SDK has a single choice of C library: newlib_.
57 The Native Client SDK also has a GCC-based toolchain for building
58 **nexes**. The GCC-based toolchain has support for two C libraries:
59 newlib_ and glibc_. See :doc:`Dynamic Linking & Loading with glibc
60 <dynamic-loading>` for information about these libraries, including factors to
61 help you decide which to use.
63 .. _building_cpp_libraries:
65 C++ standard libraries
66 ----------------------
68 The PNaCl SDK can use either LLVM's `libc++ <http://libcxx.llvm.org/>`_
69 (the current default) or GCC's `libstdc++
70 <http://gcc.gnu.org/libstdc++>`_ (deprecated). The
71 ``-stdlib=[libc++|libstdc++]`` command line argument can be used to
72 choose which standard library to use.
74 The GCC-based Native Client SDK only has support for GCC's `libstdc++
75 <http://gcc.gnu.org/libstdc++>`_.
77 C++11 library support is only complete in libc++ but other non-library language
78 features should work regardless of which standard library is used. The
79 ``-std=gnu++11`` command line argument can be used to indicate which C++
80 language standard to use (``-std=c++11`` often doesn't work well because newlib
81 relies on some GNU extensions).
86 The Native Client SDK includes multiple toolchains. It has one PNaCl toolchain
87 and it has multiple GCC-based toolchains that are differentiated by target
88 architectures and C libraries. The single PNaCl toolchain is located
89 in a directory named ``pepper_<version>/toolchain/<OS_platform>_pnacl``,
90 and the GCC-based toolchains are located in directories named
91 ``pepper_<version>/toolchain/<OS_platform>_<architecture>_<c_library>``.
93 The compilers, linkers, and other tools are located in the ``bin/``
94 subdirectory in each toolchain. For example, the tools in the Windows SDK
95 for PNaCl has a C++ compiler in ``toolchain/win_pnacl/bin/pnacl-clang++``.
97 SDK toolchains versus your hosted toolchain
98 -------------------------------------------
100 To build NaCl modules, you must use one of the Native Client toolchains
101 included in the SDK. The SDK toolchains use a variety of techniques to
102 ensure that your NaCl modules comply with the security constraints of
103 the Native Client sandbox.
105 During development, you have another choice: You can build modules using a
106 *standard* toolchain, such as the hosted toolchain on your development
107 machine. This can be Visual Studio's standard compiler, XCode, LLVM, or
108 GNU-based compilers on your development machine. These standard toolchains
109 will not produce executables that comply with the Native Client sandbox
110 security constraints. They are also not portable across operating systems
111 and not portable across different processors. However, using a standard
112 toolchain allows you to develop modules in your favorite IDE and use
113 your favorite debugging and profiling tools. The drawback is that modules
114 compiled in this manner can only run as Pepper (PPAPI) plugins in Chrome.
115 To publish and distribute Native Client modules as part of a web
116 application, you must eventually use a toolchain in the Native
122 In the future, additional tools will be available to compile Native Client
123 modules written in other programming languages, such as C#. But this
124 document covers only compiling C and C++ code, using the toolchains
131 The PNaCl toolchain contains modified versions of the tools in the
132 LLVM toolchain, as well as linkers and other tools from binutils.
133 To determine which version of LLVM or binutils the tools are based upon,
134 run the tool with the ``--version`` command line flag. These tools
135 are used to compile and link applications into **.pexe** files. The toolchain
136 also contains a tool to translate a **pexe** file into a
137 architecture-specific **.nexe** (e.g., for debugging purposes).
139 Some of the useful tools include:
142 Checks that the **pexe** follows the PNaCl ABI rules.
144 Creates archives (i.e., static libraries)
146 Object dumper for PNaCl bitcode files.
148 C compiler and compiler driver
150 C++ compiler and compiler driver
152 Compresses a finalized **pexe** file for deployment.
154 Disassembler for both **pexe** files and **nexe** files
156 Finalizes **pexe** files for deployment
160 Lists symbols in bitcode files, native code, and libraries
162 Generates a symbol table for archives (i.e., static libraries)
164 Translates a **pexe** to a native architecture, outside of the browser
166 For the full list of tools, see the
167 ``pepper_<version>/toolchain/<platform>_pnacl/bin`` directory.
169 Using the PNaCl tools to compile, link, debug, and deploy
170 =========================================================
172 To build an application with the PNaCl SDK toolchain, you must compile
173 your code, link it, test and debug it, and then deploy it. This section goes
174 over some examples of how to use the tools.
179 To compile a simple application consisting of ``file1.cc`` and ``file2.cc`` into
180 ``hello_world.pexe`` use the ``pnacl-clang++`` tool
185 nacl_sdk/pepper_<version>/toolchain/win_pnacl/bin/pnacl-clang++ \
186 file1.cc file2.cc -Inacl_sdk/pepper_<version>/include \
187 -Lnacl_sdk/pepper_<version>/lib/pnacl/Release -o hello_world.pexe \
188 -g -O2 -lppapi_cpp -lppapi
190 The typical application consists of many files. In that case,
191 each file can be compiled separately so that only files that are
192 affected by a change need to be recompiled. To compile an individual
193 file from your application, you must use either the ``pnacl-clang`` C
194 compiler, or the ``pnacl-clang++`` C++ compiler. The compiler produces
195 separate bitcode files. For example:
200 nacl_sdk/pepper_<version>/toolchain/win_pnacl/bin/pnacl-clang++ \
201 hello_world.cc -Inacl_sdk/pepper_<version>/include -c \
202 -o hello_world.o -g -O0
204 For a description of each command line flag, run ``pnacl-clang --help``.
205 For convenience, here is a description of some of the flags used in
211 indicates that ``pnacl-clang++`` should only compile an individual file,
212 rather than continue the build process and link together the
216 indicates the **output** filename.
219 tells the compiler to include debug information in the result.
220 This debug information can be used during development, and then **stripped**
221 before actually deploying the application to keep the application's
225 sets the optimization level to n. Use ``-O0`` when debugging, and ``-O2`` or
226 ``-O3`` for deployment.
228 The main difference between ``-O2`` and ``-O3`` is whether the compiler
229 performs optimizations that involve a space-speed tradeoff. It could be the
230 case that ``-O3`` optimizations are not desirable due to increased **pexe**
231 download size; you should make your own performance measurements to determine
232 which level of optimization is right for you. When looking at code size, note
233 that what you generally care about is not the size of the **pexe** produced by
234 ``pnacl-clang``, but the size of the compressed **pexe** that you upload to
235 the server or to the Chrome Web Store. Optimizations that increase the size of
236 an uncompressed **pexe** may not increase the size of the compressed **pexe**
237 very much. You should also verify how optimization level affects on-device
238 translation time, this can be tested locally with ``pnacl-translate``.
241 adds a directory to the search path for **include** files. The SDK has
242 Pepper (PPAPI) headers located at ``nacl_sdk/pepper_<version>/
243 include``, so add that directory when compiling to be able to include the
246 ``-mllvm -inline-threshold=n``
247 change how much inlining is performed by LLVM (the default is 225, a smaller
248 value will result in less inlining being performed). The right number to
249 choose is application-specific, you'll therefore want to experiment with the
250 value that you pass in: you'll be trading off potential performance with
251 **pexe** size and on-device translation speed.
253 Create a static library
254 -----------------------
256 The ``pnacl-ar`` and ``pnacl-ranlib`` tools allow you to create a
257 **static** library from a set of bitcode files, which can later be linked
258 into the full application.
263 nacl_sdk/pepper_<version>/toolchain/win_pnacl/bin/pnacl-ar cr \
264 libfoo.a foo1.o foo2.o foo3.o
266 nacl_sdk/pepper_<version>/toolchain/win_pnacl/bin/pnacl-ranlib libfoo.a
272 The ``pnacl-clang++`` tool is used to compile applications, but it can
273 also be used link together compiled bitcode and libraries into a
279 nacl_sdk/pepper_<version>/toolchain/win_pnacl/bin/pnacl-clang++ \
280 -o hello_world.pexe hello_world.o -Lnacl_sdk/pepper_<version>/lib/pnacl/Debug \
281 -lfoo -lppapi_cpp -lppapi
283 This links the hello world bitcode with the ``foo`` library in the example
284 as well as the *Debug* version of the Pepper libraries which are located
285 in ``nacl_sdk/pepper_<version>/lib/pnacl/Debug``. If you wish to link
286 against the *Release* version of the Pepper libraries, change the
287 ``-Lnacl_sdk/pepper_<version>/lib/pnacl/Debug`` to
288 ``-Lnacl_sdk/pepper_<version>/lib/pnacl/Release``.
290 In a release build you'll want to pass ``-O2`` to the compiler *as well as to
291 the linker* to enable link-time optimizations. This reduces the size and
292 increases the performance of the final **pexe**, and leads to faster downloads
293 and on-device translation.
298 nacl_sdk/pepper_<version>/toolchain/win_pnacl/bin/pnacl-clang++ \
299 -o hello_world.pexe hello_world.o -Lnacl_sdk/pepper_<version>/lib/pnacl/Release \
300 -lfoo -lppapi_cpp -lppapi -O2
302 By default the link step will turn all C++ exceptions into calls to ``abort()``
303 to reduce the size of the final **pexe** as well as making it translate and run
304 faster. If you want to use C++ exceptions you should use the
305 ``--pnacl-exceptions=sjlj`` linker flag as explained in the :ref:`exception
306 handling <exception_handling>` section of the C++ language support reference.
309 Finalizing the **pexe** for deployment
310 --------------------------------------
312 Typically you would run the application to test it and debug it if needed before
313 deploying. See the :doc:`running <running>` documentation for how to run a PNaCl
314 application, and see the :doc:`debugging <debugging>` documentation for
315 debugging techniques and workflow. After testing a PNaCl application, you must
316 **finalize** it. The ``pnacl-finalize`` tool handles this.
321 nacl_sdk/pepper_<version>/toolchain/win_pnacl/bin/pnacl-finalize \
322 hello_world.pexe -o hello_world.final.pexe
324 Prior to finalization, the application **pexe** is stored in a binary
325 format that is subject to change. After finalization, the application
326 **pexe** is **rewritten** into a different binary format that is **stable**
327 and will be supported by future versions of PNaCl. The finalization step
328 also helps minimize the size of your application for distribution by
329 stripping out debug information and other metadata.
331 Once the application is finalized, be sure to adjust the manifest file to
332 refer to the final version of the application before deployment.
333 The ``create_nmf.py`` tool helps generate an ``.nmf`` file, but ``.nmf``
334 files can also be written by hand.
339 Compressing the **pexe** for deployment
340 ---------------------------------------
342 Size compression is an optional step for deployment, and reduces the size of the
343 **pexe** file that must be transmitted over the wire, resulting in faster
344 download speed. The tool ``pnacl-compress`` applies compression strategies that
345 are already built into the **stable** binary format of a **pexe**
346 application. As such, compressed **pexe** files do not need any extra time to be
347 decompressed on the client's side. All costs are upfront when you call
350 Currently, this tool will compress **pexe** files by about 25%. However,
351 it is somewhat slow (can take from seconds to minutes on large
352 appications). Hence, this step is optional.
357 nacl_sdk/pepper_<version>/toolchain/win_pnacl/bin/pnacl-compress \
358 hello_world.final.pexe
360 ``pnacl-compress`` must be called after a **pexe** file has been finalized for
361 deployment (via ``pnacl-finalize``). Alternatively, you can apply this step as
362 part of the finalizing step by adding the ``--compress`` flag to the
363 ``pnacl-finalize`` command line.
365 This compression step doesn't replace the gzip compression performed web servers
366 configured for HTTP compression: both compressions are complementary. You'll
367 want to configure your web server to gzip **pexe** files: the gzipped version of
368 a compressed **pexe** file is smaller than the corresponding uncompressed
369 **pexe** file by 7.5% to 10%.
373 Object dumping of PNaCl bitcode files
374 =====================================
376 Sometimes you may be interesting in the contents of a PNaCl bitcode file. The
377 tool ``pnacl-bcdis`` object dumps the contents of a PNaCl bitcode file. For a
378 description of the output produced by this tool, see
379 :doc:`/reference/pnacl-bitcode-manual`.
384 nacl_sdk/pepper_<version>/toolchain/win_pnacl/bin/pnacl-bcdis \
385 hello_world.final.pexe
387 The output is the corresponding contents of the given **pexe**.
389 The GNU-based toolchains
390 ========================
392 Besides the PNaCl toolchain, the Native Client SDK also includes modified
393 versions of the tools in the standard GNU toolchain, including the GCC
394 compilers and the linkers and other tools from binutils. These tools only
395 support building **nexe** files. Run the tool with the ``--version``
396 command line flag to determine the current version of the tools.
398 Each tool in the toolchain is prefixed with the name of the target
399 architecture. In the toolchain for the ARM target architecture, each
400 tool's name is preceded by the prefix "arm-nacl-". In the toolchains for
401 the x86 target architecture, there are actually two versions of each
402 tool---one to build Native Client modules for the x86-32
403 target architecture, and one to build modules for the x86-64 target
404 architecture. "i686-nacl-" is the prefix for tools used to build
405 32-bit **.nexes**, and "x86_64-nacl-" is the prefix for tools used to
406 build 64-bit **.nexes**.
408 These prefixes conform to gcc naming standards and make it easy to use tools
409 like autoconf. As an example, you can use ``i686-nacl-gcc`` to compile 32-bit
410 **.nexes**, and ``x86_64-nacl-gcc`` to compile 64-bit **.nexes**. Note that you
411 can typically override a tool's default target architecture with command line
412 flags, e.g., you can specify ``x86_64-nacl-gcc -m32`` to compile a 32-bit
415 The GNU-based SDK toolchains include the following tools:
443 Compiling files with the GNU-based toolchain is similar to compiling
444 files with the PNaCl-based toolchain, except that the output is
445 architecture specific.
447 For example, assuming you're developing on a Windows machine, targeting the x86
448 architecture, and using the newlib library, you can compile a 32-bit **.nexe**
449 for the hello_world example with the following command:
454 nacl_sdk/pepper_<version>/toolchain/win_x86_newlib/bin/i686-nacl-gcc \
455 hello_world.c -Inacl_sdk/pepper_<version>/include \
456 -Lnacl_sdk/pepper_<version>/lib/newlib/Release -o hello_world_x86_32.nexe \
459 To compile a 64-bit **.nexe**, you can run the same command but use -m64 instead
460 of -m32. Alternatively, you could also use the version of the compiler that
461 targets the x86-64 architecture, i.e., ``x86_64-nacl-gcc``.
463 You should name executable modules with a **.nexe** filename extension,
464 regardless of what platform you're using.
466 Creating libraries and Linking
467 ------------------------------
469 Creating libraries and linking with the GNU-based toolchain is similar
470 to doing the same with the PNaCl toolchain. The relevant tools
471 for creating **static** libraries are ``<prefix>ar`` and ``<prefix>ranlib``.
472 Linking can be done with ``<prefix>g++``. See the
473 :doc:`Dynamic Linking & Loading with glibc <dynamic-loading>`
474 section on how to create **shared** libraries.
477 Finalizing a **nexe** for deployment
478 ------------------------------------
480 Unlike the PNaCl toolchain, no separate finalization step is required
481 for **nexe** files. The **nexe** files are always in a **stable** format.
482 However, the **nexe** file may contain debug information and symbol information
483 which may make the **nexe** file larger than needed for distribution.
484 To minimize the size of the distributed file, you can run the
485 ``<prefix>strip`` tool to strip out debug information.
491 This document doesn't cover how to use ``make``, but if you want to use
492 ``make`` to build your Native Client module, you can base your Makefile on the
493 ones in the SDK examples.
495 The Makefiles for the SDK examples build most of the examples in multiple
496 configurations (using PNaCl vs NaCl, using different C libraries,
497 targeting different architectures, and using different levels of optimization).
498 To select a specific toolchain, set the **environment variable**
499 ``TOOLCHAIN`` to either ``pnacl``, ``newlib``, ``glibc``, or ``host``.
500 To select a specific level of optimization set the **environment
501 variable** ``CONFIG`` to either ``Debug``, or ``Release``. Running
502 ``make`` in each example's directory does **one** of the following,
503 depending on the setting of the environment variables.
505 * If ``TOOLCHAIN=pnacl`` creates a subdirectory called ``pnacl``;
507 * builds a **.pexe** (architecture-independent Native Client executable) using
509 * generates a Native Client manifest (.nmf) file for the pnacl version of the
512 * If ``TOOLCHAIN=newlib`` creates a subdirectory called ``newlib``;
514 * builds **.nexes** for the x86-32, x86-64, and ARM architectures using the
516 * generates a Native Client manifest (.nmf) file for the newlib version of
519 * If ``TOOLCHAIN=glibc`` creates a subdirectory called ``glibc``;
521 * builds **.nexes** for the x86-32 and x86-64 architectures using the glibc
523 * generates a Native Client manifest (.nmf) file for the glibc version of the
526 * If ``TOOLCHAIN=host`` creates a subdirectory called ``windows``, ``linux``,
527 or ``mac`` (depending on your development machine);
529 * builds a Pepper plugin (.dll for Windows, .so for Linux/Mac) using the
530 hosted toolchain on your development machine
531 * generates a Native Client manifest (.nmf) file for the host Pepper plugin
532 version of the example
538 The glibc library is not yet available for the ARM and PNaCl toolchains.
540 Here is how to build the examples with PNaCl in Release mode on Windows.
541 The resulting files for ``examples/api/audio`` will be in
542 ``examples/api/audio/pnacl/Release``, and the directory layout is similar for
552 Your Makefile can be simpler since you will not likely want to build so many
553 different configurations of your module. The example Makefiles define
554 numerous variables near the top (e.g., ``CFLAGS``) that make it easy
555 to customize the commands that are executed for your project and the options
558 For details on how to use make, see the `GNU 'make' Manual
559 <http://www.gnu.org/software/make/manual/make.html>`_.
561 Libraries and header files provided with the SDK
562 ================================================
564 The Native Client SDK includes modified versions of standard toolchain-support
565 libraries, such as libpthread and libc, plus the relevant header files.
566 The standard libraries are located under the ``/pepper_<version>`` directory
567 in the following locations:
569 * PNaCl toolchain: ``toolchain/<platform>_pnacl/usr/lib``
570 * x86 toolchains: ``toolchain/<platform>_x86_<c_library>/x86_64-nacl/lib32`` and
571 ``/lib64`` (for the 32-bit and 64-bit target architectures, respectively)
572 * ARM toolchain: ``toolchain/<platform>_arm_<c_library>/arm-nacl/lib``
574 For example, on Windows, the libraries for the x86-64 architecture in the
575 newlib toolchain are in ``toolchain/win_x86_newlib/x86_64-nacl/lib64``.
577 The header files are in:
579 * PNaCl toolchain: ``toolchain/<platform>_pnacl/usr/include``
580 * x86 toolchains: ``toolchain/<platform>_x86_<c_library>/x86_64-nacl/include``
581 * ARM toolchain: ``toolchain/<platform>_arm_<c_library>/arm-nacl/include``
583 Many other libraries have been ported for use with Native Client; for more
584 information, see the `naclports <http://code.google.com/p/naclports/>`_
585 project. If you port an open-source library for your own use, we recommend
586 adding it to naclports.
588 Besides the standard libraries, the SDK includes Pepper libraries.
589 The PNaCl Pepper libraries are located in the the
590 ``nacl_sdk/pepper_<version>/lib/pnacl/<Release or Debug>`` directory.
591 The GNU-based toolchain has Pepper libraries in
592 ``nacl_sdk/pepper_<version>/lib/newlib_<arch>/<Release or Debug>``
593 and ``nacl_sdk/pepper_<version>/lib/glibc_<arch>/<Release or Debug>``.
594 The libraries provided by the SDK allow the application to use Pepper,
595 as well as convenience libraries to simplify porting an application that
596 uses POSIX functions. Here are descriptions of the Pepper libraries provided
599 .. _devcycle-building-nacl-io:
602 Implements the Pepper (PPAPI) C interface. Needed for all applications that
603 use Pepper (even C++ applications).
606 Implements the Pepper (PPAPI) C++ interface. Needed by C++ applications that
610 Implements the Pepper (PPAPI) GLES interface. Needed by applications
611 that use the 3D graphics API.
614 Provides a POSIX layer for NaCl. In particular, the library provides a
615 virtual file system and support for sockets. The virtual file system
616 allows a module to "mount" a given directory tree. Once a module has
617 mounted a file system, it can use standard C library file operations:
618 ``fopen``, ``fread``, ``fwrite``, ``fseek``, and ``fclose``.
619 For more detail, see the header ``include/nacl_io/nacl_io.h``.
620 For an example of how to use nacl_io, see ``examples/demo/nacl_io_demo``.
623 Provides a familiar C programming environment by letting a module have a
624 simple entry point that is registered by ``PPAPI_SIMPLE_REGISTER_MAIN``.
625 The entry point is similar to the standard C ``main()`` function, complete
626 with ``argc`` and ``argv[]`` parameters. For details see
627 ``include/ppapi_simple/ps.h``. For an example of
628 how to use ppapi_simple, ``see examples/tutorial/using_ppapi_simple``.
634 * Since the Native Client toolchains use their own library and header search
635 paths, the tools won't find third-party libraries you use in your
636 non-Native-Client development. If you want to use a specific third-party
637 library for Native Client development, look for it in `naclports
638 <http://code.google.com/p/naclports/>`_, or port the library yourself.
639 * The order in which you list libraries in your build commands is important,
640 since the linker searches and processes libraries in the order in which they
641 are specified. See the ``\*_LDFLAGS`` variables in the Makefiles of the SDK
642 examples for the order in which specific libraries should be listed.
647 Some common problems, and how to fix them:
649 "Undefined reference" error
650 ---------------------------
652 An "undefined reference" error may indicate incorrect link order and/or
653 missing libraries. For example, if you leave out ``-lppapi`` when
654 compiling Pepper applications you'll see a series of undefined
657 One common type of "undefined reference" error is with respect to certain
658 system calls, e.g., "undefined reference to 'mkdir'". For security reasons,
659 Native Client does not support a number of system calls. Depending on how
660 your code uses such system calls, you have a few options:
662 #. Link with the ``-lnosys`` flag to provide empty/always-fail versions of
663 unsupported system calls. This will at least get you past the link stage.
664 #. Find and remove use of the unsupported system calls.
665 #. Create your own implementation of the unsupported system calls to do
666 something useful for your application.
668 If your code uses mkdir or other file system calls, you might find the
669 :ref:`nacl_io <devcycle-building-nacl-io>` library useful.
670 The nacl_io library essentially does option (3) for you: It lets your
671 code use POSIX-like file system calls, and implements the calls using
672 various technologies (e.g., HTML5 file system, read-only filesystems that
673 use URL loaders, or an in-memory filesystem).
675 Can't find libraries containing necessary symbols
676 -------------------------------------------------
678 Here is one way to find the appropriate library for a given symbol:
683 nacl_sdk/pepper_<version>/toolchain/<platform>_pnacl/bin/pnacl-nm -o \
684 nacl_sdk/pepper_<version>toolchain/<platform>_pnacl/usr/lib/*.a | \
688 PNaCl ABI Verification errors
689 -----------------------------
691 PNaCl has restrictions on what is supported in bitcode. There is a bitcode
692 ABI verifier which checks that the application conforms to the ABI restrictions,
693 before it is translated and run in the browser. However, it is best to
694 avoid runtime errors for users, so the verifier also runs on the developer's
695 machine at link time.
697 For example, the following program which uses 128-bit integers
698 would compile with NaCl GCC for the x86-64 target. However, it is not
699 portable and would not compile with NaCl GCC for the i686 target.
700 With PNaCl, it would fail to pass the ABI verifier:
704 typedef unsigned int uint128_t __attribute__((mode(TI)));
706 uint128_t foo(uint128_t x) {
710 With PNaCl you would get the following error at link time:
714 Function foo has disallowed type: i128 (i128)
715 LLVM ERROR: PNaCl ABI verification failed
717 When faced with a PNaCl ABI verification error, check the list of features
718 that are :ref:`not supported by PNaCl <when-to-use-nacl>`.
719 If the problem you face is not listed as restricted,
720 :ref:`let us know <help>`!
722 .. _glibc: http://www.gnu.org/software/libc/
723 .. _newlib: http://sourceware.org/newlib/