diff options
-rwxr-xr-x | emcc | 1 | ||||
-rwxr-xr-x | emscripten.py | 4 | ||||
-rw-r--r-- | src/library.js | 4 |
3 files changed, 6 insertions, 3 deletions
@@ -1109,6 +1109,7 @@ try: if shared.Settings.ALIASING_FUNCTION_POINTERS: logging.warning('disabling ALIASING_FUNCTION_POINTERS for dlopen support') shared.Settings.ALIASING_FUNCTION_POINTERS = 0 + shared.Settings.RESERVED_FUNCTION_POINTERS = max(shared.Settings.RESERVED_FUNCTION_POINTERS, 10) if shared.Settings.ASSERTIONS and shared.Settings.ALIASING_FUNCTION_POINTERS: logging.warning('ALIASING_FUNCTION_POINTERS is on, function pointer comparisons may be invalid across types') diff --git a/emscripten.py b/emscripten.py index 9f54e07f..3dba10c3 100755 --- a/emscripten.py +++ b/emscripten.py @@ -624,10 +624,14 @@ Runtime.stackRestore = function(top) { asm['stackRestore'](top) }; return masks[sig] return re.sub(r'{{{ FTM_([\w\d_$]+) }}}', lambda m: fix(m), js) # masks[m.groups(0)[0]] funcs_js = map(lambda js: function_table_maskize(js, masks), funcs_js) + if settings.get('DLOPEN_SUPPORT'): funcs_js.append(''' asm.maxFunctionIndex = %d; ''' % max_mask) + for sig in last_forwarded_json['Functions']['tables'].iterkeys(): + funcs_js.append(' var F_BASE_%s = 0;\n' % sig) + else: function_tables_defs = '\n'.join([table for table in last_forwarded_json['Functions']['tables'].itervalues()]) outfile.write(function_tables_defs) diff --git a/src/library.js b/src/library.js index 3e244c67..c160c785 100644 --- a/src/library.js +++ b/src/library.js @@ -5132,9 +5132,7 @@ LibraryManager.library = { } else { var result = lib.module[symbol]; if (typeof result == 'function') { - {{{ Functions.getTable('x') }}}.push(result); - {{{ Functions.getTable('x') }}}.push(0); - result = {{{ Functions.getTable('x') }}}.length - 2; + result = Runtime.addFunction(result); lib.cached_functions = result; } return result; |