aboutsummaryrefslogtreecommitdiff
path: root/emscripten.py
diff options
context:
space:
mode:
authorJez Ng <me@jezng.com>2013-07-09 07:02:47 -0700
committerJez Ng <me@jezng.com>2013-07-11 20:37:57 -0700
commitc1e1d87bc3b9e249795543e44a1224c2f03154ce (patch)
tree3f8506715b75acdf97e68dfdc3e4c1a35ffccb5a /emscripten.py
parent9f9af4cefb142960cad37b3f43f4777e4334f2f2 (diff)
Implement self-dlopen.
Diffstat (limited to 'emscripten.py')
-rwxr-xr-xemscripten.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/emscripten.py b/emscripten.py
index d9367566..921ab879 100755
--- a/emscripten.py
+++ b/emscripten.py
@@ -620,6 +620,16 @@ Runtime.stackRestore = function(top) { asm['stackRestore'](top) };
// EMSCRIPTEN_END_FUNCS
''']
+ # Create symbol table for self-dlopen
+ if settings.get('LINKABLE'):
+ GLOBAL_BASE = forwarded_json['Runtime']['GLOBAL_BASE']
+ symbol_table = {k:v+8 for k,v in forwarded_json['Variables']['indexedGlobals'].iteritems()}
+ for raw in last_forwarded_json['Functions']['tables'].itervalues():
+ table = raw[raw.find('[')+1:raw.find(']')].split(",")
+ symbol_table.update(map(lambda x: (x[1], x[0]),
+ filter(lambda x: x[1] != '0', enumerate(table))))
+ outfile.write("var SYMBOL_TABLE = %s;" % json.dumps(symbol_table))
+
for funcs_js_item in funcs_js: # do this loop carefully to save memory
funcs_js_item = indexize(funcs_js_item)
funcs_js_item = blockaddrsize(funcs_js_item)