aboutsummaryrefslogtreecommitdiff
path: root/src/jsifier.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-01-16 11:18:06 -0800
committerAlon Zakai <alonzakai@gmail.com>2012-01-16 11:18:06 -0800
commit5fe3bcc54b6c7ee04d0b09cc3e44e0cd06b95405 (patch)
tree2cf6d3a26b321328941346235d0c4f7db919ab3b /src/jsifier.js
parent58132ad51111bcb024f7a9f2bdce970324c05e00 (diff)
refactor runtime init and exit code
Diffstat (limited to 'src/jsifier.js')
-rw-r--r--src/jsifier.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index b14c213f..db6936f6 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -254,9 +254,9 @@ function JSify(data, functionsOnly, givenFunctions) {
assert(!item.lines); // FIXME remove this, after we are sure it isn't needed
var ret = [item];
if (item.ident == '_llvm_global_ctors') {
- item.JS = '\n__globalConstructor__ = function() {\n' +
- item.ctors.map(function(ctor) { return ' ' + toNiceIdent(ctor) + '();' }).join('\n') +
- '\n}\n';
+ item.JS = '\n__ATINIT__ = __ATINIT__.concat([\n' +
+ item.ctors.map(function(ctor) { return ' { func: ' + toNiceIdent(ctor) + ' }' }).join(',\n') +
+ '\n]);\n';
return ret;
} else {
if (item.external && BUILD_AS_SHARED_LIB) {