Skip to content
Open
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
5 changes: 5 additions & 0 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -1538,6 +1538,11 @@ def test_whole_archive(self):
self.run_process([EMCC, '-Wl,-whole-archive', '-Wl,--no-whole-archive', 'libtest.a', 'main.o'])
self.assertContained('foo is: 0\n', self.run_js('a.out.js'))

def test_side_module_whole_archive(self):
# Make sure -sSIDE_MODULE=1 passes --whole-archive to the linker
err = self.run_process([EMCC, test_file('hello_world.c'), '-sSIDE_MODULE=1', '-v', '-o', 'side.wasm'], stderr=PIPE).stderr
self.assertContained('--whole-archive', err)

def test_whole_archive_48156(self):
# Regression test for http://llvm.org/PR48156
# TODO: distill this test further and move to lld
Expand Down
2 changes: 1 addition & 1 deletion tools/building.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ def lld_flags(args, linker_inputs=None):

# Emscripten currently expects linkable output (SIDE_MODULE/MAIN_MODULE) to
# include all archive contents.
if settings.LINKABLE and (settings.FAKE_DYLIBS or not settings.SIDE_MODULE):
if settings.LINKABLE and (settings.FAKE_DYLIBS or settings.SIDE_MODULE != 2):
args.insert(0, '--whole-archive')
args.append('--no-whole-archive')

Expand Down
Loading