@@ -61,13 +61,23 @@ var LibraryDylink = {
61
61
}
62
62
} ,
63
63
64
- $updateGOT__deps : [ '$GOT' ] ,
64
+ $isInternalSym : function ( symName ) {
65
+ // TODO: find a way to mark these in the binary or avoid exporting them.
66
+ return [
67
+ '__cpp_exception' ,
68
+ '__wasm_apply_data_relocs' ,
69
+ '__dso_handle' ,
70
+ '__set_stack_limits'
71
+ ] . indexOf ( symName ) != - 1 ;
72
+ } ,
73
+
74
+ $updateGOT__deps : [ '$GOT' , '$isInternalSym' ] ,
65
75
$updateGOT : function ( exports ) {
66
76
#if DYLINK_DEBUG
67
77
err ( "updateGOT: " + Object . keys ( exports ) . length ) ;
68
78
#endif
69
79
for ( var symName in exports ) {
70
- if ( symName == '__cpp_exception' || symName == '__dso_handle' || symName == '__wasm_apply_relocs' ) {
80
+ if ( isInternalSym ( symName ) ) {
71
81
continue ;
72
82
}
73
83
@@ -410,6 +420,10 @@ var LibraryDylink = {
410
420
if ( ! flags . allowUndefined ) {
411
421
reportUndefinedSymbols ( ) ;
412
422
}
423
+ #if STACK_OVERFLOW_CHECK >= 2
424
+
425
+ moduleExports [ '__set_stack_limits' ] ( _emscripten_stack_get_base ( ) , _emscripten_stack_get_end ( ) ) ;
426
+ #endif
413
427
// initialize the module
414
428
var init = moduleExports [ '__post_instantiate' ] ;
415
429
if ( init ) {
@@ -468,7 +482,7 @@ var LibraryDylink = {
468
482
// If a library was already loaded, it is not loaded a second time. However
469
483
// flags.global and flags.nodelete are handled every time a load request is made.
470
484
// Once a library becomes "global" or "nodelete", it cannot be removed or unloaded.
471
- $loadDynamicLibrary__deps: [ '$LDSO' , '$loadWebAssemblyModule' , '$asmjsMangle' , '$fetchBinary' ] ,
485
+ $loadDynamicLibrary__deps: [ '$LDSO' , '$loadWebAssemblyModule' , '$asmjsMangle' , '$fetchBinary' , '$isInternalSym' ] ,
472
486
$loadDynamicLibrary : function ( lib , flags ) {
473
487
if ( lib == '__main__' && ! LDSO . loadedLibNames [ lib ] ) {
474
488
LDSO . loadedLibs [ - 1 ] = {
@@ -577,7 +591,7 @@ var LibraryDylink = {
577
591
else {
578
592
var curr = Module [ sym ] , next = libModule [ sym ] ;
579
593
// don't warn on functions - might be odr, linkonce_odr, etc.
580
- if ( ! ( typeof curr === 'function' && typeof next === 'function' ) ) {
594
+ if ( ! ( typeof curr === 'function' && typeof next === 'function' ) && ! isInternalSym ( sym ) ) {
581
595
err ( "warning: symbol '" + sym + "' from '" + lib + "' already exists (duplicate symbol? or weak linking, which isn't supported yet?)" ) ;
582
596
}
583
597
}
0 commit comments