Skip to content

Commit 3a8cb2a

Browse files
authored
Improve warning message when ignore fake shared libraries. NFC (#23594)
Also, add a test for this warning which was previously not tested.
1 parent f9ca632 commit 3a8cb2a

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

test/test_other.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12866,9 +12866,12 @@ def test_euidaccess(self):
1286612866
self.do_other_test('test_euidaccess.c')
1286712867

1286812868
def test_shared_flag(self):
12869+
self.run_process([EMCC, '-shared', test_file('hello_world.c'), '-o', 'libother.so'])
12870+
1286912871
# Test that `-shared` flag causes object file generation but gives a warning
12870-
err = self.run_process([EMCC, '-shared', test_file('hello_world.c'), '-o', 'out.foo'], stderr=PIPE).stderr
12872+
err = self.run_process([EMCC, '-shared', test_file('hello_world.c'), '-o', 'out.foo', 'libother.so'], stderr=PIPE).stderr
1287112873
self.assertContained('linking a library with `-shared` will emit a static object', err)
12874+
self.assertContained('emcc: warning: ignoring dynamic library libother.so when generating an object file, this will need to be included explicitly in the final link', err)
1287212875
self.assertIsObjectFile('out.foo')
1287312876

1287412877
# Test that using an executable output name overrides the `-shared` flag, but produces a warning.

tools/link.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2894,7 +2894,7 @@ def filter_out_fake_dynamic_libs(options, inputs):
28942894
def is_fake_dylib(input_file):
28952895
if get_file_suffix(input_file) in DYLIB_EXTENSIONS and os.path.exists(input_file) and not building.is_wasm_dylib(input_file):
28962896
if not options.ignore_dynamic_linking:
2897-
diagnostics.warning('emcc', 'ignoring dynamic library %s because not compiling to JS or HTML, remember to link it when compiling to JS or HTML at the end', os.path.basename(input_file))
2897+
diagnostics.warning('emcc', 'ignoring dynamic library %s when generating an object file, this will need to be included explicitly in the final link', os.path.basename(input_file))
28982898
return True
28992899
else:
29002900
return False

0 commit comments

Comments
 (0)