This directory contains the services required to execute both nexes and pexes.
For information about how to build and use nexes and pexes from within Mojo, refer to the mojo/nacl
directory.
The nexe content handler is simple. It:
The pexe content handler is slightly more complex. Although it is similar in structure to the Non-SFI nexe content handler, it has an additional step between item 1 and 2: convert the incoming pexe into a nexe.
This pexe to nexe translation requires two steps: compilation and linking. For each of these steps, a helper service is launched. These helper services are actually executed as nexes -- pnacl_llc.nexe
and ld.nexe
. The translation done by these nexes is executed as part of a callback to IRT functions, nacl_irt_private_pnacl_translator_compile
, and nacl_irt_private_pnacl_translator_link
. This makes communication between the content handler and these helper nexes more complicated.
For the full picture of the compilation process:
PexeCompilerStart
, passing in the child end of the message pipe. This contacts a new service which is responsible for launching pnacl_llc.nexe
.mojo/nacl/nonsfi/irt_pnacl_translator_compile.cc
). This creates the PexeCompiler
service, which is ready to handle a single request. It is bound to the child end of the pipe.PexeCompiler
service. Now, PexeCompile
can be called with inputs defined by a mojom interface, and outputs can be received via callbackPexeCompile
, passing in the name of the pexe, and receiving the object files created by compilationThe linking process works similarly, but utilizes a different interface which lets it receive object files and return a linked nexe. Once linking has finished, the PexeContentHandler may choose to cache the resultant nexe so that future clients accessing the same pexe will be able to skip the translation process.
Once both the compilation and linking steps have been completed, the PexeContentHandler is able to launch the requested nexe.
Note: For x86 and x86-64 systems, Subzero is used for translating the pexe into a native format, and sz.nexe
is used instead of pnacl-llc.nexe
.