@@ -20,7 +20,6 @@ function createLock() {
2020 // * global
2121 // * undefined // when we dont
2222 function libraryType ( path ) {
23- console . log ( "check lib type for" , path ) ;
2423 if ( path . includes ( "cpython-3" ) && path . includes ( "-wasm32-emscripten.so" ) ) {
2524 return "local" ;
2625 }
@@ -40,58 +39,38 @@ async function loadDynlibsFromPackage(
4039 dynlibPaths ,
4140) {
4241
43-
44-
45- // if(pkg_file_name == "zlib") {
46- // console.log("zlib is always loaded, skipping loading from package");
47- // return;
48- // }
4942 if ( prefix != "/" )
5043 {
5144 throw `only root prefix / is supported for loading shared libraries from packages, got: ${ prefix } ` ;
5245 }
5346
54- console . log ( "LAPALUZA" ) ;
55-
5647 // console.log("load shared objects from package:", pkg_file_name, dynlibPaths);
5748 for ( let i = 0 ; i < dynlibPaths . length ; i ++ ) {
5849 let path = dynlibPaths [ i ] ;
5950
60- // // if the name contains "_tests" we skip loading the shared libraries
61- // if (path.includes("_tests") || path.includes("_simd")) {
62- // console.log(`skipping loading shared libraries from package ${pkg_file_name} because it is a test package or simd package`);
63- // continue;
64- // }
65-
6651 const isSymlink = FS . isLink ( FS . lstat ( path ) ) ;
6752 if ( isSymlink ) {
68- console . log ( `skipping symlinked shared library ${ path } from package ${ pkg_file_name } ` ) ;
6953 continue ;
7054 }
7155
7256 const releaseDynlibLock = await _lock ( ) ;
7357 try {
7458
75- //#define RTLD_LAZY 1
76- // #define RTLD_NOW 2
77- // #define RTLD_NOLOAD 4
78- // #define RTLD_NODELETE 4096
79- // #define RTLD_GLOBAL 256
80- // #define RTLD_LOCAL 0
59+ // RTLD_LAZY 1
60+ // RTLD_NOW 2
61+ // RTLD_NOLOAD 4
62+ // RTLD_NODELETE 4096
63+ // RTLD_GLOBAL 256
64+ // RTLD_LOCAL 0
8165
8266 const libt = libraryType ( path ) ;
8367 let flag = 2 ; // RTLD_NOW
84- // if(libt === "local"){
85- // console.log(`loading local shared library ${path} from package ${pkg_file_name}`);
86- // flag = 2 /* RTLD_NOW */ | 0 /* RTLD_LOCAL */;
87- // }
88- // else if(libt === "global"){
89- // console.log(`loading global shared library ${path} from package ${pkg_file_name}`);
90- // flag = 2 /* RTLD_NOW */ | 256 /* RTLD_GLOBAL */;
91- // }
92- // else{
93- // console.log(`loading shared library ${path} from package ${pkg_file_name} with default flags`);
94- // }
68+ if ( libt === "local" ) {
69+ flag = 2 /* RTLD_NOW */ | 0 /* RTLD_LOCAL */ ;
70+ }
71+ else if ( libt === "global" ) {
72+ flag = 2 /* RTLD_NOW */ | 256 /* RTLD_GLOBAL */ ;
73+ }
9574
9675 const stack = Module . stackSave ( ) ;
9776 const pathUTF8 = Module . stringToUTF8OnStack ( path ) ;
@@ -129,15 +108,7 @@ async function loadDynlibsFromPackage(
129108
130109 }
131110
132- if ( libt !== "local" ) {
133- console . log ( 're-register shared library with filename without path' ) ;
134- // get filename from path
135- const filename = getFilenameFromPath ( path ) ;
136- console . log ( `registering shared library ${ path } from package ${ pkg_file_name } as ${ filename } in global namespace` ) ;
137- // Module.LDSO.loadedLibsByName[filename] = Module.LDSO.loadedLibsByName[path];
138-
139- }
140- console . log ( `!!!!!!!!!shared library ${ path } from package ${ pkg_file_name } is ready` ) ;
111+
141112 } catch ( e ) {
142113 throw e ;
143114 } finally {
0 commit comments