aboutsummaryrefslogtreecommitdiff
path: root/emscripten.py
diff options
context:
space:
mode:
Diffstat (limited to 'emscripten.py')
-rwxr-xr-xemscripten.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/emscripten.py b/emscripten.py
index ce929858..77082aee 100755
--- a/emscripten.py
+++ b/emscripten.py
@@ -474,6 +474,9 @@ def emscript(infile, settings, outfile, libraries=[], compiler_engine=None,
basic_vars.append('F_BASE_%s' % sig)
asm_setup += ' var F_BASE_%s = %s;\n' % (sig, 'FUNCTION_TABLE_OFFSET' if settings.get('SIDE_MODULE') else '0') + '\n'
+ if '_rand' in exported_implemented_functions or '_srand' in exported_implemented_functions:
+ basic_vars += ['___rand_seed']
+
asm_runtime_funcs = ['stackAlloc', 'stackSave', 'stackRestore', 'setThrew'] + ['setTempRet%d' % i for i in range(10)]
# function tables
function_tables = ['dynCall_' + table for table in last_forwarded_json['Functions']['tables']]
@@ -518,6 +521,7 @@ def emscript(infile, settings, outfile, libraries=[], compiler_engine=None,
exports = '{ ' + ', '.join(exports) + ' }'
else:
exports = '_main'
+
# calculate globals
try:
del forwarded_json['Variables']['globals']['_llvm_global_ctors'] # not a true variable
@@ -975,6 +979,9 @@ def emscript_fast(infile, settings, outfile, libraries=[], compiler_engine=None,
basic_vars.append('F_BASE_%s' % sig)
asm_setup += ' var F_BASE_%s = %s;\n' % (sig, 'FUNCTION_TABLE_OFFSET' if settings.get('SIDE_MODULE') else '0') + '\n'
+ if '_rand' in exported_implemented_functions or '_srand' in exported_implemented_functions:
+ basic_vars += ['___rand_seed']
+
asm_runtime_funcs = ['stackAlloc', 'stackSave', 'stackRestore', 'setThrew'] + ['setTempRet%d' % i for i in range(10)]
# function tables
function_tables = ['dynCall_' + table for table in last_forwarded_json['Functions']['tables']]