Commit ee35d772 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 912f0555
...@@ -17,11 +17,15 @@ all : prog.js ...@@ -17,11 +17,15 @@ all : prog.js
libf_so.$(SO) : libf.c libf_so.$(SO) : libf.c
$(CC) -s SIDE_MODULE=1 -DLIBF_COMPILE -o $@ $< $(CC) -s SIDE_MODULE=1 -DLIBF_COMPILE -o $@ $<
# FIXME RUNTIME_LINKED_LIBS does not work for SIDE_MODULE=1
# Currently it is worked around with __attribute__(constructor) in libk.c
#
# TODO teach emscripten/support.js:loadDynamicLibrary() to check loaded
# module.dynamicLibraries and further load dependent shared libs automatically.
libk_so.$(SO) : libk.c libf.h libf_so.$(SO) libk_so.$(SO) : libk.c libf.h libf_so.$(SO)
$(CC) -s SIDE_MODULE=1 -s RUNTIME_LINKED_LIBS="['libf_so.$(SO)']" -DLIBK_COMPILE -o $@ $< $(CC) -s SIDE_MODULE=1 -s RUNTIME_LINKED_LIBS="['libf_so.$(SO)']" -DLIBK_COMPILE -o $@ $<
# FIXME link in libf_so in libk_so
prog.js : prog.c libk_so.$(SO) prog.js : prog.c libk_so.$(SO)
$(CC) -s MAIN_MODULE=1 -s RUNTIME_LINKED_LIBS="['libk_so.$(SO)']" -o $@ prog.c $(CC) -s MAIN_MODULE=1 -s RUNTIME_LINKED_LIBS="['libk_so.$(SO)']" -o $@ prog.c
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
// XXX should be in make, but currently emscripten cannot do this // XXX should be in make, but currently emscripten cannot do this
__attribute__((constructor)) __attribute__((constructor))
static void init_ctor() { static void init() {
// XXX EM_ASM does not work in wasm mode // XXX EM_ASM does not work in wasm mode
# if 1 # if 1
EM_ASM({ EM_ASM({
......
...@@ -45,7 +45,7 @@ gb = alignMemory(getMemory(48 + 1), 1 || 1); ...@@ -45,7 +45,7 @@ gb = alignMemory(getMemory(48 + 1), 1 || 1);
for (var i = gb; i < gb + 48; ++i) HEAP8[i] = 0; for (var i = gb; i < gb + 48; ++i) HEAP8[i] = 0;
// STATICTOP = STATIC_BASE + 48; // STATICTOP = STATIC_BASE + 48;
/* global initializers */ __ATINIT__.push({ func: function() { _init_ctor() } }); /* global initializers */ __ATINIT__.push({ func: function() { _init() } });
/* memory initializer */ allocate([123,32,108,111,97,100,68,121,110,97,109,105,99,76,105,98,114,97,114,121,40,39,108,105,98,102,95,115,111,46,106,115,39,41,59,32,125,0], "i8", ALLOC_NONE, gb); /* memory initializer */ allocate([123,32,108,111,97,100,68,121,110,97,109,105,99,76,105,98,114,97,114,121,40,39,108,105,98,102,95,115,111,46,106,115,39,41,59,32,125,0], "i8", ALLOC_NONE, gb);
...@@ -194,7 +194,7 @@ function setThrew(threw, value) { ...@@ -194,7 +194,7 @@ function setThrew(threw, value) {
} }
} }
function _init_ctor() { function _init() {
var $0 = 0, label = 0, sp = 0; var $0 = 0, label = 0, sp = 0;
sp = STACKTOP; sp = STACKTOP;
$0 = _emscripten_asm_const_i(0)|0; $0 = _emscripten_asm_const_i(0)|0;
...@@ -216,15 +216,15 @@ function runPostSets() { ...@@ -216,15 +216,15 @@ function runPostSets() {
// EMSCRIPTEN_END_FUNCS // EMSCRIPTEN_END_FUNCS
return { _init_ctor: _init_ctor, _kfunc1: _kfunc1, establishStackSpace: establishStackSpace, runPostSets: runPostSets, setThrew: setThrew, stackAlloc: stackAlloc, stackRestore: stackRestore, stackSave: stackSave }; return { _init: _init, _kfunc1: _kfunc1, establishStackSpace: establishStackSpace, runPostSets: runPostSets, setThrew: setThrew, stackAlloc: stackAlloc, stackRestore: stackRestore, stackSave: stackSave };
}) })
// EMSCRIPTEN_END_ASM // EMSCRIPTEN_END_ASM
(Module.asmGlobalArg, Module.asmLibraryArg, buffer); (Module.asmGlobalArg, Module.asmLibraryArg, buffer);
var real__init_ctor = asm["_init_ctor"]; asm["_init_ctor"] = function() { var real__init = asm["_init"]; asm["_init"] = function() {
assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)'); assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)'); assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
return real__init_ctor.apply(null, arguments); return real__init.apply(null, arguments);
}; };
var real__kfunc1 = asm["_kfunc1"]; asm["_kfunc1"] = function() { var real__kfunc1 = asm["_kfunc1"]; asm["_kfunc1"] = function() {
...@@ -238,7 +238,7 @@ var real_setThrew = asm["setThrew"]; asm["setThrew"] = function() { ...@@ -238,7 +238,7 @@ var real_setThrew = asm["setThrew"]; asm["setThrew"] = function() {
assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)'); assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
return real_setThrew.apply(null, arguments); return real_setThrew.apply(null, arguments);
}; };
var _init_ctor = Module["_init_ctor"] = asm["_init_ctor"]; var _init = Module["_init"] = asm["_init"];
var _kfunc1 = Module["_kfunc1"] = asm["_kfunc1"]; var _kfunc1 = Module["_kfunc1"] = asm["_kfunc1"];
var runPostSets = Module["runPostSets"] = asm["runPostSets"]; var runPostSets = Module["runPostSets"] = asm["runPostSets"];
var setThrew = Module["setThrew"] = asm["setThrew"]; var setThrew = Module["setThrew"] = asm["setThrew"];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment