Search code examples
google-nativeclient

How to compress native client .nexe binary file


Is there any command like pnacl-compress to compress an already compiled native client .nexe file?

Thanks


Solution

  • pnacl-bccompress compresses a .pexe file. .nexe files are either x86-32, x86-64, ARM or MIPS, and compressing these is trickier and probably not the best approach.

    Instead I suggest playing with LLVM's command-line options to generate smaller bitcode files, which will result in smaller .nexe files. First, run pnacl-clang with --pnacl-driver-verbose to see the command lines being run. Then add or remove options from opt (note that the order of these is important!). Especially useful will be the inlining threshold, and mergefuncs. You can disassemble the intermediate bitcode files with llvm-dis to see if there's anything unexpected in there, or if LLVM generates extra big functions or globals. LLVM has a bunch of other command line options to play with, but those aren't [P]NaCl specific at all so I'll avoid listing them here.