Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wasm-study
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
wasm-study
Commits
ee35d772
Commit
ee35d772
authored
Nov 07, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
912f0555
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
8 deletions
+12
-8
Makefile
Makefile
+5
-1
libk.c
libk.c
+1
-1
libk_so.js
libk_so.js
+6
-6
No files found.
Makefile
View file @
ee35d772
...
@@ -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
...
...
libk.c
View file @
ee35d772
...
@@ -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
({
...
...
libk_so.js
View file @
ee35d772
...
@@ -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
"
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment