diff --git a/emcc.py b/emcc.py index d02b5276873d2..305c2c4036fae 100755 --- a/emcc.py +++ b/emcc.py @@ -4182,8 +4182,8 @@ def process_libraries(state, linker_inputs): # let wasm-ld handle that. However, we do want to map to the correct variant. # For example we map `-lc` to `-lc-mt` if we are building with threading support. if 'lib' + lib in system_libs_map: - lib = system_libs_map['lib' + lib] - new_flags.append((i, '-l' + strip_prefix(lib.get_base_name(), 'lib'))) + lib = system_libs_map['lib' + lib].get_link_flag() + new_flags.append((i, lib)) continue if building.map_and_apply_to_settings(lib): diff --git a/test/test_other.py b/test/test_other.py index 0d41f9713d3b9..e34d2e8faba45 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -12109,8 +12109,6 @@ def test_offset_convertor_plus_wasm2js(self): def test_standard_library_mapping(self): # Test the `-l` flags on the command line get mapped the correct libraries variant - self.run_process([EMBUILDER, 'build', 'libc-mt-debug', 'libcompiler_rt-mt', 'libdlmalloc-mt']) - libs = ['-lc', '-lbulkmemory', '-lcompiler_rt', '-lmalloc'] err = self.run_process([EMCC, test_file('hello_world.c'), '-pthread', '-nodefaultlibs', '-v'] + libs, stderr=PIPE).stderr diff --git a/tools/system_libs.py b/tools/system_libs.py index 3c767f2b0d0cf..aecf7c2aa96cc 100644 --- a/tools/system_libs.py +++ b/tools/system_libs.py @@ -426,7 +426,7 @@ def get_link_flag(self): This will trigger a build if this library is not in the cache. """ fullpath = self.build() - # For non-libaries (e.g. crt1.o) we pass the entire path to the linker + # For non-libraries (e.g. crt1.o) we pass the entire path to the linker if self.get_ext() != '.a': return fullpath # For libraries (.a) files, we pass the abbreviated `-l` form.