Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure system libraries are built on demand #19405

Merged
merged 1 commit into from
May 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions emcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 0 additions & 2 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion tools/system_libs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down