diff --git a/docs/emcc.txt b/docs/emcc.txt index 844b274a6ceef..4c122f2f4fc93 100644 --- a/docs/emcc.txt +++ b/docs/emcc.txt @@ -635,6 +635,8 @@ Environment variables * "EMCC_SKIP_SANITY_CHECK" [general] + * "EMCC_SUPPORT_BIG_ENDIAN" [general] + * "EM_IGNORE_SANITY" [general] * "EM_CONFIG" [general] diff --git a/src/settings.js b/src/settings.js index b63ff2fa86acd..6115d04dd133c 100644 --- a/src/settings.js +++ b/src/settings.js @@ -293,12 +293,6 @@ var DECLARE_ASM_MODULE_EXPORTS = true; // [compile] var INLINING_LIMIT = false; -// If set to 1, perform acorn pass that converts each HEAP access into a -// function call that uses DataView to enforce LE byte order for HEAP buffer; -// This makes generated JavaScript run on BE as well as LE machines. (If 0, only -// LE systems are supported). Does not affect generated wasm. -var SUPPORT_BIG_ENDIAN = false; - // Check each write to the heap, for example, this will give a clear // error on what would be segfaults in a native build (like dereferencing // 0). See runtime_safe_heap.js for the actual checks performed. diff --git a/tools/settings.py b/tools/settings.py index 9c8480811161f..6a056eaa8ed51 100644 --- a/tools/settings.py +++ b/tools/settings.py @@ -122,6 +122,15 @@ def read_js_settings(filename, attrs): if 'EMCC_STRICT' in os.environ: self.attrs['STRICT'] = int(os.environ.get('EMCC_STRICT')) + # If set, perform acorn pass that converts each HEAP access into a function + # call that uses DataView to enforce LE byte order for HEAP buffer; This + # makes generated JavaScript run on BE as well as LE machines. (If 0, only + # LE systems are supported). Does not affect generated wasm. + if 'EMCC_SUPPORT_BIG_ENDIAN' in os.environ: + self.attrs['SUPPORT_BIG_ENDIAN'] = int(os.environ.get('EMCC_SUPPORT_BIG_ENDIAN')) + else: + self.attrs['SUPPORT_BIG_ENDIAN'] = 0 + # Special handling for LEGACY_SETTINGS. See src/setting.js for more # details for legacy in self.attrs['LEGACY_SETTINGS']: