So the irt_core nexe is untrusted code in the Native Client sandbox implementing mostly the equivalent of libc syscall wrappers for the NaCl VM, plus some other libc stuff like pthreads and malloc. I believe it is treated the same as any other untrusted code by the sandbox. (There are some examples in the NaCl repo's tests/barebones/ showing how VM syscalls can be done without the library.) So we might consider ditching the IRT nexe shipped with the engine, and instead build it into each gamelogic binary. This would let us reach the goal of building a Daemon engine without binary blobs much more simply than if we had to build irt_core. To build everything we need from native_client the normal way you need to set up 3 toolchains:
- Target platform native code toolchain for
sel_ldr
- NaCl toolchain(s) to build
irt_core_raw
- Host-mode toolchain to build the
tls_edit tool which transforms irt_core_raw into irt_core (only actually needed for 32-bit targets)
If we build the IRT files as normal gamelogic files, the latter two toolchains would no longer needed to produce a built-from-scratch Daemon release. I'm assuming that tls_edit is only needed for the case where the code is loaded like a shared library, and not if it's built into the main binary.
If my assumptions are correct the steps to do this would be:
- Add Native Client as a submodule
- Add the IRT source files there into any gamelogic build
- Remove the
-B <irt_core path> flag from the nacl_loader invocation
Obviously the reason to have the IRT in the first place is to save compile time and disk space for those distributing nexe binaries. The irt_core-amd64.nexe we currently ship is 623K. But Bloaty says 46% of that is debug info. Strip that as our build process normally does, perhaps remove some unused parts while linking, and it's maybe a couple hundred KB. Plus Breakpad debug info for the IRT would be generated in the normal build process.
Building an irt_core_raw with Saigo single-threadedly took 0.94 s for me excluding build system overhead. (I got Total command execution time: 0.938376 seconds using the Scons --debug=time option.)
So the
irt_corenexe is untrusted code in the Native Client sandbox implementing mostly the equivalent of libc syscall wrappers for the NaCl VM, plus some other libc stuff like pthreads and malloc. I believe it is treated the same as any other untrusted code by the sandbox. (There are some examples in the NaCl repo'stests/barebones/showing how VM syscalls can be done without the library.) So we might consider ditching the IRT nexe shipped with the engine, and instead build it into each gamelogic binary. This would let us reach the goal of building a Daemon engine without binary blobs much more simply than if we had to buildirt_core. To build everything we need fromnative_clientthe normal way you need to set up 3 toolchains:sel_ldrirt_core_rawtls_edittool which transformsirt_core_rawintoirt_core(only actually needed for 32-bit targets)If we build the IRT files as normal gamelogic files, the latter two toolchains would no longer needed to produce a built-from-scratch Daemon release. I'm assuming that
tls_editis only needed for the case where the code is loaded like a shared library, and not if it's built into the main binary.If my assumptions are correct the steps to do this would be:
-B <irt_core path>flag from thenacl_loaderinvocationObviously the reason to have the IRT in the first place is to save compile time and disk space for those distributing nexe binaries. The
irt_core-amd64.nexewe currently ship is 623K. But Bloaty says 46% of that is debug info. Strip that as our build process normally does, perhaps remove some unused parts while linking, and it's maybe a couple hundred KB. Plus Breakpad debug info for the IRT would be generated in the normal build process.Building an
irt_core_rawwith Saigo single-threadedly took 0.94 s for me excluding build system overhead. (I gotTotal command execution time: 0.938376 secondsusing the Scons--debug=timeoption.)