diff --git a/test/core/pthread/test_pthread_dlopen_many.c b/test/core/pthread/test_pthread_dlopen_many.c index 4d853cc8e1da2..f945af51ac5dc 100644 --- a/test/core/pthread/test_pthread_dlopen_many.c +++ b/test/core/pthread/test_pthread_dlopen_many.c @@ -30,7 +30,7 @@ void* thread_main(void* arg) { while (thread_count != NUM_THREADS) {} char filename[255]; - sprintf(filename, "liblib%d.so", num); + sprintf(filename, "libside%d.so", num); printf("loading %s\n", filename); void* handle = dlopen(filename, RTLD_NOW|RTLD_GLOBAL); printf("done loading %s (total=%d)\n", filename, ++dso_count); diff --git a/test/core/pthread/test_pthread_dlsym.c b/test/core/pthread/test_pthread_dlsym.c index 51ea3a2cf4b9d..149ac2d79f179 100644 --- a/test/core/pthread/test_pthread_dlsym.c +++ b/test/core/pthread/test_pthread_dlsym.c @@ -10,7 +10,7 @@ func_t g_two; func_t g_three; void* open_lib() { - void* handle = dlopen("liblib.so", RTLD_NOW|RTLD_GLOBAL); + void* handle = dlopen("libside.so", RTLD_NOW|RTLD_GLOBAL); if (!handle) { printf("dlerror: %s\n", dlerror()); assert(handle); diff --git a/test/core/pthread/test_pthread_dylink_entry_point.c b/test/core/pthread/test_pthread_dylink_entry_point.c index a91a4639b8f3f..59843f6aefa11 100644 --- a/test/core/pthread/test_pthread_dylink_entry_point.c +++ b/test/core/pthread/test_pthread_dylink_entry_point.c @@ -7,7 +7,7 @@ typedef void* (*thread_main_t)(void*); int main() { puts("hello from main"); - void *lib_handle = dlopen("./liblib.so", RTLD_NOW); + void *lib_handle = dlopen("./libside.so", RTLD_NOW); if (!lib_handle) { puts("cannot load side module"); puts(dlerror()); diff --git a/test/test_core.py b/test/test_core.py index c39b3412a69d6..6d9003cfbdbaa 100644 --- a/test/test_core.py +++ b/test/test_core.py @@ -2979,7 +2979,7 @@ def test_nestedstructs(self): def prep_dlfcn_main(self, libs=None): if libs is None: - libs = ['liblib.so'] + libs = ['libside.so'] self.clear_setting('SIDE_MODULE') # Link against the side modules but don't load them on startup. self.set_setting('NO_AUTOLOAD_DYLIBS') @@ -2988,7 +2988,7 @@ def prep_dlfcn_main(self, libs=None): # specify EXPORTED_FUNCTIONS. self.set_setting('MAIN_MODULE', 2) - def build_dlfcn_lib(self, filename, outfile='liblib.so', cflags=None): + def build_dlfcn_lib(self, filename, outfile='libside.so', cflags=None): self.clear_setting('MAIN_MODULE') self.set_setting('SIDE_MODULE') cmd = [compiler_for(filename), filename, '-o', outfile] + self.get_cflags() @@ -3029,7 +3029,7 @@ def test_dlfcn_basic(self, args): if args: self.setup_node_pthreads() self.cflags += args - create_file('liblib.cpp', ''' + create_file('libside.cpp', ''' #include class Foo { @@ -3041,7 +3041,7 @@ class Foo { Foo side_global; ''') - self.build_dlfcn_lib('liblib.cpp') + self.build_dlfcn_lib('libside.cpp') self.prep_dlfcn_main() src = ''' @@ -3058,7 +3058,7 @@ class Bar { Bar global; int main() { - dlopen("liblib.so", RTLD_NOW); + dlopen("libside.so", RTLD_NOW); return 0; } ''' @@ -3066,14 +3066,14 @@ class Bar { @needs_dylink def test_dlfcn_i64(self): - create_file('liblib.c', ''' + create_file('libside.c', ''' #include int64_t foo(int x) { return (long long)x / (long long)1234; } ''') - self.build_dlfcn_lib('liblib.c') + self.build_dlfcn_lib('libside.c') self.prep_dlfcn_main() src = r''' @@ -3085,7 +3085,7 @@ def test_dlfcn_i64(self): typedef int64_t (*int64func)(int); int main() { - void *lib_handle = dlopen("liblib.so", RTLD_NOW); + void *lib_handle = dlopen("libside.so", RTLD_NOW); if (!lib_handle) { puts(dlerror()); abort(); @@ -3105,7 +3105,7 @@ def test_dlfcn_i64(self): @needs_dylink def test_dlfcn_em_asm(self): - create_file('liblib.cpp', ''' + create_file('libside.cpp', ''' #include class Foo { public: @@ -3115,7 +3115,7 @@ class Foo { }; Foo side_global; ''') - self.build_dlfcn_lib('liblib.cpp') + self.build_dlfcn_lib('libside.cpp') self.prep_dlfcn_main() src = ''' @@ -3129,7 +3129,7 @@ class Bar { }; Bar global; int main() { - dlopen("liblib.so", RTLD_NOW); + dlopen("libside.so", RTLD_NOW); EM_ASM( out("All done.") ); return 0; } @@ -3138,7 +3138,7 @@ class Bar { @needs_dylink def test_dlfcn_qsort(self): - create_file('liblib.c', ''' + create_file('libside.c', ''' int lib_cmp(const void* left, const void* right) { const int* a = (const int*) left; const int* b = (const int*) right; @@ -3153,7 +3153,7 @@ def test_dlfcn_qsort(self): return lib_cmp; } ''') - self.build_dlfcn_lib('liblib.c') + self.build_dlfcn_lib('libside.c') self.prep_dlfcn_main() src = ''' @@ -3184,7 +3184,7 @@ def test_dlfcn_qsort(self): } printf("\\n"); - lib_handle = dlopen("liblib.so", RTLD_NOW); + lib_handle = dlopen("libside.so", RTLD_NOW); if (lib_handle == NULL) { printf("Could not load lib.\\n"); return 1; @@ -3209,7 +3209,7 @@ def test_dlfcn_qsort(self): @needs_dylink def test_dlfcn_data_and_fptr(self): - create_file('liblib.c', r''' + create_file('libside.c', r''' #include int theglobal = 42; @@ -3235,7 +3235,7 @@ def test_dlfcn_data_and_fptr(self): return lib_fptr; } ''') - self.build_dlfcn_lib('liblib.c') + self.build_dlfcn_lib('libside.c') self.prep_dlfcn_main() src = r''' @@ -3260,7 +3260,7 @@ def test_dlfcn_data_and_fptr(self): FUNCTYPE* func_fptr; // Test basic lib loading. - lib_handle = dlopen("liblib.so", RTLD_NOW); + lib_handle = dlopen("libside.so", RTLD_NOW); if (lib_handle == NULL) { printf("Could not load lib.\n"); return 1; @@ -3305,13 +3305,13 @@ def test_dlfcn_varargs(self): # this test is not actually valid - it fails natively. the child should fail # to be loaded, not load and successfully see the parent print_ints func - create_file('liblib.c', r''' + create_file('libside.c', r''' void print_ints(int n, ...); void func() { print_ints(2, 13, 42); } ''') - self.build_dlfcn_lib('liblib.c') + self.build_dlfcn_lib('libside.c') self.prep_dlfcn_main() src = r''' @@ -3335,7 +3335,7 @@ def test_dlfcn_varargs(self): print_ints(2, 100, 200); - lib_handle = dlopen("liblib.so", RTLD_NOW); + lib_handle = dlopen("libside.so", RTLD_NOW); assert(lib_handle); fptr = (void (*)())dlsym(lib_handle, "func"); fptr(); @@ -3351,15 +3351,15 @@ def test_dlfcn_varargs(self): @no_4gb('output is sensitive to absolute data layout') def test_dlfcn_alignment_and_zeroing(self): self.set_setting('INITIAL_MEMORY', '16mb') - create_file('liblib.c', r''' + create_file('libside.c', r''' int prezero = 0; __attribute__((aligned(1024))) int superAligned = 12345; int postzero = 0; ''') - self.build_dlfcn_lib('liblib.c') + self.build_dlfcn_lib('libside.c') for i in range(10): curr = '%d.so' % i - shutil.copy('liblib.so', curr) + shutil.copy('libside.so', curr) self.prep_dlfcn_main() self.set_setting('INITIAL_MEMORY', '128mb') @@ -3461,14 +3461,14 @@ def get_data_exports(wasm): @needs_dylink def test_dlfcn_unique_sig(self): - create_file('liblib.c', r''' + create_file('libside.c', r''' #include int myfunc(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m) { return 13; } ''') - self.build_dlfcn_lib('liblib.c') + self.build_dlfcn_lib('libside.c') self.prep_dlfcn_main() create_file('main.c', r''' @@ -3482,7 +3482,7 @@ def test_dlfcn_unique_sig(self): void *lib_handle; FUNCTYPE func_ptr; - lib_handle = dlopen("liblib.so", RTLD_NOW); + lib_handle = dlopen("libside.so", RTLD_NOW); assert(lib_handle != NULL); func_ptr = (FUNCTYPE)dlsym(lib_handle, "myfunc"); @@ -3498,14 +3498,14 @@ def test_dlfcn_unique_sig(self): @needs_dylink def test_dlfcn_info(self): - create_file('liblib.c', r''' + create_file('libside.c', r''' #include int myfunc(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m) { return 13; } ''') - self.build_dlfcn_lib('liblib.c') + self.build_dlfcn_lib('libside.c') self.prep_dlfcn_main() create_file('main.c', ''' @@ -3520,7 +3520,7 @@ def test_dlfcn_info(self): void *lib_handle; FUNCTYPE func_ptr; - lib_handle = dlopen("liblib.so", RTLD_NOW); + lib_handle = dlopen("libside.so", RTLD_NOW); assert(lib_handle != NULL); func_ptr = (FUNCTYPE)dlsym(lib_handle, "myfunc"); @@ -3545,7 +3545,7 @@ def test_dlfcn_info(self): @needs_dylink def test_dlfcn_stacks(self): - create_file('liblib.c', r''' + create_file('libside.c', r''' #include #include #include @@ -3560,7 +3560,7 @@ def test_dlfcn_stacks(self): return strlen(bigstack); } ''') - self.build_dlfcn_lib('liblib.c') + self.build_dlfcn_lib('libside.c') self.prep_dlfcn_main() create_file('main.c', ''' @@ -3582,7 +3582,7 @@ def test_dlfcn_stacks(self): // is able to use it. assert(!strcmp(str, "foobar")); - lib_handle = dlopen("liblib.so", RTLD_NOW); + lib_handle = dlopen("libside.so", RTLD_NOW); assert(lib_handle != NULL); func_ptr = (FUNCTYPE)dlsym(lib_handle, "myfunc"); @@ -3598,7 +3598,7 @@ def test_dlfcn_stacks(self): @needs_dylink def test_dlfcn_funcs(self): - create_file('liblib.c', r''' + create_file('libside.c', r''' #include #include #include @@ -3629,7 +3629,7 @@ def test_dlfcn_funcs(self): } } ''') - self.build_dlfcn_lib('liblib.c') + self.build_dlfcn_lib('libside.c') self.prep_dlfcn_main() create_file('main.c', r''' @@ -3652,7 +3652,7 @@ def test_dlfcn_funcs(self): int main() { printf("go\n"); void *lib_handle; - lib_handle = dlopen("liblib.so", RTLD_NOW); + lib_handle = dlopen("libside.so", RTLD_NOW); assert(lib_handle != NULL); voidcaller callvoid = (voidcaller)dlsym(lib_handle, "callvoid"); @@ -3691,7 +3691,7 @@ def test_dlfcn_funcs(self): @needs_dylink def test_dlfcn_longjmp(self): - create_file('liblib.c', r''' + create_file('libside.c', r''' #include #include @@ -3702,7 +3702,7 @@ def test_dlfcn_longjmp(self): printf("pre %d\n", i); } ''') - self.build_dlfcn_lib('liblib.c') + self.build_dlfcn_lib('libside.c') self.prep_dlfcn_main() create_file('main.c', r''' @@ -3717,7 +3717,7 @@ def test_dlfcn_longjmp(self): printf("go!\n"); void *lib_handle; - lib_handle = dlopen("liblib.so", RTLD_NOW); + lib_handle = dlopen("libside.so", RTLD_NOW); assert(lib_handle != NULL); jumpfunc jumpy = (jumpfunc)dlsym(lib_handle, "jumpy"); @@ -3750,7 +3750,7 @@ def test_dlfcn_longjmp(self): @needs_dylink @with_all_eh_sjlj def test_dlfcn_exceptions(self): - create_file('liblib.cpp', r''' + create_file('libside.cpp', r''' extern "C" { int ok() { return 65; @@ -3760,7 +3760,7 @@ def test_dlfcn_exceptions(self): } } ''') - self.build_dlfcn_lib('liblib.cpp') + self.build_dlfcn_lib('libside.cpp') self.prep_dlfcn_main() create_file('main.cpp', r''' @@ -3774,7 +3774,7 @@ def test_dlfcn_exceptions(self): printf("go!\n"); void *lib_handle; - lib_handle = dlopen("liblib.so", RTLD_NOW); + lib_handle = dlopen("libside.so", RTLD_NOW); assert(lib_handle != NULL); intfunc okk = (intfunc)dlsym(lib_handle, "ok"); @@ -3881,12 +3881,12 @@ def test_dlfcn_handle_alloc(self): def test_dlfcn_feature_in_lib(self): self.cflags.append('-mnontrapping-fptoint') - create_file('liblib.c', r''' + create_file('libside.c', r''' int magic(float x) { return __builtin_wasm_trunc_saturate_s_i32_f32(x); } ''') - self.build_dlfcn_lib('liblib.c') + self.build_dlfcn_lib('libside.c') self.prep_dlfcn_main() src = r''' @@ -3897,7 +3897,7 @@ def test_dlfcn_feature_in_lib(self): typedef int (*fi)(float); int main() { - void *lib_handle = dlopen("liblib.so", RTLD_NOW); + void *lib_handle = dlopen("libside.so", RTLD_NOW); if (!lib_handle) { puts(dlerror()); abort(); @@ -3916,7 +3916,7 @@ def test_dlfcn_feature_in_lib(self): @needs_dylink @with_asyncify_and_jspi def test_dlfcn_asyncify(self): - create_file('liblib.c', r''' + create_file('libside.c', r''' #include #include @@ -3927,7 +3927,7 @@ def test_dlfcn_asyncify(self): return 42; } ''') - self.build_dlfcn_lib('liblib.c') + self.build_dlfcn_lib('libside.c') self.prep_dlfcn_main() src = r''' @@ -3937,7 +3937,7 @@ def test_dlfcn_asyncify(self): typedef int (*func_t)(); int main(int argc, char **argv) { - void *_dlHandle = dlopen("liblib.so", RTLD_NOW | RTLD_LOCAL); + void *_dlHandle = dlopen("libside.so", RTLD_NOW | RTLD_LOCAL); func_t my_func = (func_t)dlsym(_dlHandle, "side_module_run"); printf("%d\n", my_func()); return 0; @@ -4089,7 +4089,7 @@ def dylink_test(self, main, side, expected=None, header=None, force_c=False, main_module=2, **kwargs): # Same as dylink_testf but take source code in string form if not isinstance(side, list): - side_file = 'liblib.cpp' if not force_c else 'liblib.c' + side_file = 'libside.cpp' if not force_c else 'libside.c' create_file(side_file, side) side = side_file if not isinstance(main, list): @@ -4104,7 +4104,7 @@ def dylink_test(self, main, side, expected=None, header=None, force_c=False, def dylink_testf(self, main, side=None, expected=None, force_c=False, main_cflags=None, main_module=2, so_dir='', - so_name='liblib.so', + so_name='libside.so', **kwargs): main_cflags = main_cflags or [] if getattr(self, 'dylink_reversed', False): @@ -4211,7 +4211,7 @@ def test_dylink_safe_heap(self): @with_dylink_reversed def test_dylink_locate_file(self): so_dir = 'so_dir' - so_name = 'liblib.so' + so_name = 'libside.so' os.mkdir(so_dir) create_file('pre.js', ''' Module['locateFile'] = (f) => { @@ -4551,7 +4551,7 @@ def test_dylink_i64_invoke(self, rtld_local): int main(int argc, char *argv[]) { int64_t temp = 42; #if USE_DLOPEN - void* lib = dlopen("liblib.so", RTLD_LAZY); + void* lib = dlopen("libside.so", RTLD_LAZY); assert(lib); sidey_t sidey = (sidey_t)dlsym(lib, "sidey"); assert(sidey); @@ -4995,7 +4995,7 @@ def test_dylink_exceptions_try_catch_6(self): #include int main() { printf("in main\n"); - void* handle = dlopen("liblib.so", RTLD_LAZY); + void* handle = dlopen("libside.so", RTLD_LAZY); assert(handle); void (*side)(void) = (void (*)(void))dlsym(handle, "side"); (side)(); @@ -5008,7 +5008,7 @@ def test_dylink_exceptions_try_catch_6(self): # functions created in library_exceptions.js. # This means we end up depending on dynamic linking code to redirect # __cxa_find_matching_catch_6 to __cxa_find_matching_catch. - create_file('liblib.cpp', r''' + create_file('libside.cpp', r''' #include extern "C" void side() { printf("in side\n"); @@ -5031,7 +5031,7 @@ def test_dylink_exceptions_try_catch_6(self): # side settings self.clear_setting('MAIN_MODULE') self.set_setting('SIDE_MODULE') - self.build('liblib.cpp', output_suffix='.so') + self.build('libside.cpp', output_suffix='.so') # main settings self.set_setting('MAIN_MODULE', 1) @@ -5127,13 +5127,13 @@ def test_dylink_load_compiled_side_module(self): extern int sidef(); int main() { EM_ASM({ - var libData = FS.readFile('liblib.so', {encoding: 'binary'}); + var libData = FS.readFile('libside.so', {encoding: 'binary'}); if (!(libData instanceof Uint8Array)) { libData = new Uint8Array(libData); } var compiledModule = new WebAssembly.Module(libData); var sideExports = loadWebAssemblyModule(compiledModule, {loadAsync: false, nodelete: true}); - mergeLibSymbols(sideExports, 'liblib.so'); + mergeLibSymbols(sideExports, 'libside.so'); }); printf("sidef: %d.\n", sidef()); } @@ -8019,7 +8019,7 @@ def test_source_map(self): def test_embind_dylink_visibility_hidden(self): # Check that embind is usable from a library built with "-fvisibility=hidden" - create_file('liblib.cpp', r''' + create_file('libside.cpp', r''' #include #define EXPORT __attribute__((visibility("default"))) using namespace emscripten; @@ -8028,7 +8028,7 @@ def test_embind_dylink_visibility_hidden(self): val view(typed_memory_view(1, buffer)); } ''') - self.build_dlfcn_lib('liblib.cpp', cflags=['-fvisibility=hidden']) + self.build_dlfcn_lib('libside.cpp', cflags=['-fvisibility=hidden']) self.prep_dlfcn_main() self.clear_setting('NO_AUTOLOAD_DYLIBS') @@ -9416,7 +9416,7 @@ def test_pthread_dlopen(self): self.cflags += ['-Wno-experimental', '-pthread'] self.build_dlfcn_lib(test_file('core/pthread/test_pthread_dlopen_side.c')) - self.cflags += ['--embed-file', 'liblib.so@libside.so'] + self.cflags += ['--embed-file', 'libside.so@libside.so'] self.prep_dlfcn_main() self.set_setting('EXIT_RUNTIME') self.set_setting('PROXY_TO_PTHREAD') @@ -9437,7 +9437,7 @@ def test_pthread_dlopen_many(self): self.cflags += ['-Wno-experimental', '-pthread'] self.build_dlfcn_lib(test_file('core/pthread/test_pthread_dlopen_side.c')) for i in range(nthreads): - shutil.copy('liblib.so', f'liblib{i}.so') + shutil.copy('libside.so', f'libside{i}.so') self.prep_dlfcn_main() self.set_setting('EXIT_RUNTIME') @@ -9506,15 +9506,15 @@ def test_Module_dynamicLibraries(self, args): self.cflags += ['--pre-js', 'pre.js', '-sINCOMING_MODULE_JS_API=dynamicLibraries'] self.cflags += ['--js-library', 'lib.js'] # This test is for setting dynamicLibraries at runtime, so we don't - # want emscripten loading `liblib.so` automatically (which it would + # want emscripten loading `libside.so` automatically (which it would # do without this setting) self.set_setting('NO_AUTOLOAD_DYLIBS') create_file('pre.js', ''' if (typeof ENVIRONMENT_IS_PTHREAD == 'undefined' || !ENVIRONMENT_IS_PTHREAD) { - // Load liblib.so on the main thread, this would be equivalent to + // Load libside.so on the main thread, this would be equivalent to // defining it outside the module (e.g. in MODULARIZE mode). - Module['dynamicLibraries'] = ['liblib.so']; + Module['dynamicLibraries'] = ['libside.so']; } ''') @@ -9523,8 +9523,8 @@ def test_Module_dynamicLibraries(self, args): mainCallback: () => { #if PTHREADS err('sharedModules: ' + Object.keys(sharedModules)); - assert('liblib.so' in sharedModules); - assert(sharedModules['liblib.so'] instanceof WebAssembly.Module); + assert('libside.so' in sharedModules); + assert(sharedModules['libside.so'] instanceof WebAssembly.Module); #endif }, })