@@ -1353,13 +1353,19 @@ def test_multiply_defined_libsymbols(self):
13531353 }
13541354 ''')
13551355
1356+ # Check linking libA.so multiple times (both directly and indirectly) does not result
1357+ # any multiply defined symbols. This is especially important with `FAKE_DYLIBS` where
1358+ # the we model shared libraries using regular object file. Without special handling
1359+ # fake `libA.so` could get linked multiple times.
13561360 self.cflags.remove('-Werror')
13571361 self.emcc('libA.c', ['-shared', '-o', 'libA.so'])
13581362
1359- self.emcc('a2.c', ['-r', '-L.', '-lA', '-o', 'a2.o'])
1360- self.emcc('b2.c', ['-r', '-L.', '-lA', '-o', 'b2.o'])
1363+ err = self.emcc('a2.c', ['-shared', '-L.', '-lA', '-o', 'liba2.so'], stderr=PIPE).stderr
1364+ self.assertContained('emcc: warning: ignoring dynamic library libA.so when generating an object file', err)
1365+ err = self.emcc('b2.c', ['-shared', '-L.', '-lA', '-o', 'libb2.so'], stderr=PIPE).stderr
1366+ self.assertContained('emcc: warning: ignoring dynamic library libA.so when generating an object file', err)
13611367
1362- self.do_runf('main.c', 'result: 1', cflags=['-L.', '-lA', 'a2.o ', 'b2.o '])
1368+ self.do_runf('main.c', 'result: 1', cflags=['-L.', '-lA', 'liba2.so ', 'libb2.so '])
13631369
13641370 def test_multiply_defined_libsymbols_2(self):
13651371 create_file('a.c', "int x() { return 55; }")
0 commit comments