Update Native Client definitions #43
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi, this updates the Native Client definitions.
To understand it better, here is some generic knowledge about the Native Client ecosystem.
The various toolchains produced different kind of binaries:
nexe: architecture-dependent executable.pexe: architecture-independent executable, meant to be translated tonexebefore execution using a special tool.A PNaCl compiler produces
pexeexecutable, while an NaCl compiler producesnexeexecutable.While the
pexeformat can be seen as a kind of platform, in practice there is no runner for it: apexeshould be translated tonexeto be executed by the NaCl loader.There has been at least 5 Native Client compilers:
nexe;x86_64-nacl-gcc.pexe;pexe;pnacl-clang.nexe;x86_64-nacl-clang.nexe.x86_64-nacl-clang.The PNaCl Clang compiler and the NaCl Clang compiler share the same repository and are both part of the PNaCl Clang project, I listed them separately because the different binaries produce different defines.
Here is some knowledge I gathered:
Among all the compilers I tested (all but PNaCl GCC), only PNaCl Clang sets the
__pnacl__definition.All the compilers I tested (all but PNaCl GCC) set the
__native_client__definition, so this is a better one to detect Native Client than__pnacl__.I have found some
__native_client__and some__pnacl__usage in some header files in the PNaCl GCC source directory. So maybe the__pnacl__is usable to detect a pexe compiler.According to this comment, 10 years ago PNaCl Clang was built on Ubuntu 12.04 and developed on Ubuntu 14.04, so I guess the 13 years old PNaCl GCC requires an environment as old as that to be built, if not older. It's very unlikely the PNaCl GCC can be faced in the wild.
In real life, finding the
__pnacl__definition means the PNaCl Clang compiler is used.The Saigo compilers sets the
__saigo__definition.Among the users of Native Client today we can list:
Summary:
__native_client____native_client__(unverified)__pnacl__(unverified)__native_client____pnacl____native_client____native_client____saigo__While it is true facing a
__pnacl__definition means this a Native Client architecture being targeted, not all NaCl compilers set it, it is better to use__native_client__instead.So…
nexeare defining__native_client__.