diff options
-rwxr-xr-x | emcc | 3 | ||||
-rwxr-xr-x | emscripten.py | 6 | ||||
-rw-r--r-- | src/jsifier.js | 2 | ||||
-rw-r--r-- | src/settings.js | 4 | ||||
-rwxr-xr-x | tests/runner.py | 2 |
5 files changed, 12 insertions, 5 deletions
@@ -1077,6 +1077,9 @@ try: shared.Settings.LINKABLE = 1 # TODO: add FORCE_DCE option for the brave people that do want to dce here and in side modules debug_level = max(debug_level, 2) + if shared.Settings.DLOPEN_SUPPORT: + shared.Settings.LINKABLE = 1 + ## Compile source code to bitcode logging.debug('compiling to bitcode') diff --git a/emscripten.py b/emscripten.py index 5c3e28f7..1536bcdf 100755 --- a/emscripten.py +++ b/emscripten.py @@ -621,10 +621,10 @@ Runtime.stackRestore = function(top) { asm['stackRestore'](top) }; '''] # Create symbol table for self-dlopen - if settings.get('LINKABLE'): - symbol_table = {k:v+forwarded_json['Runtime']['GLOBAL_BASE'] + if settings.get('DLOPEN_SUPPORT'): + symbol_table = { k:v+forwarded_json['Runtime']['GLOBAL_BASE'] for k,v in forwarded_json['Variables']['indexedGlobals'].iteritems() - if forwarded_json['Variables']['globals'][k]['named']} + if forwarded_json['Variables']['globals'][k]['named'] } for raw in last_forwarded_json['Functions']['tables'].itervalues(): if raw == '': continue table = map(string.strip, raw[raw.find('[')+1:raw.find(']')].split(",")) diff --git a/src/jsifier.js b/src/jsifier.js index 6faea2b4..38581ce4 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -604,7 +604,7 @@ function JSify(data, functionsOnly, givenFunctions) { var associatedSourceFile = "NO_SOURCE"; } - if (LINKABLE) Functions.getIndex(func.ident); + if (DLOPEN_SUPPORT) Functions.getIndex(func.ident); func.JS += 'function ' + func.ident + '(' + paramIdents.join(', ') + ') {\n'; diff --git a/src/settings.js b/src/settings.js index 7f9dca3b..10e93975 100644 --- a/src/settings.js +++ b/src/settings.js @@ -327,6 +327,10 @@ var LINKABLE = 0; // If set to 1, this file can be linked with others, either as // LINKABLE of 0 is very useful in that we can reduce the size of the // generated code very significantly, by removing everything not actually used. +var DLOPEN_SUPPORT = 0; // Whether to support dlopen(NULL, ...) which enables dynamic access to the + // module's functions and globals. Implies LINKABLE=1, because we do not want + // dead code elimination. + var RUNTIME_TYPE_INFO = 0; // Whether to expose type info to the script at run time. This // increases the size of the generated script, but allows you // to more easily perform operations from handwritten JS on diff --git a/tests/runner.py b/tests/runner.py index 89bf0c56..18d5f4d1 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -5887,7 +5887,7 @@ def process(filename): def test_dlfcn_self(self): if Settings.USE_TYPED_ARRAYS == 1: return self.skip('Does not work with USE_TYPED_ARRAYS=1') - Settings.LINKABLE = 1 + Settings.DLOPEN_SUPPORT = 1 src = r''' #include <stdio.h> |