Skip to content

Commit c113775

Browse files
authored
Deprecate bitcode linking with llvm-link (#15724)
Also, restore some minimal testing of this feature which had been completely removed. I don't know of any remaining users of this feature and it adds a fair amount of complexity to the linking logic. See #13492
1 parent 984b5ee commit c113775

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

tests/test_other.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,10 +1114,10 @@ def test_link_group_bitcode(self):
11141114
}
11151115
''')
11161116

1117-
self.run_process([EMCC, '-o', '1.o', '-c', '1.c'])
1118-
self.run_process([EMCC, '-o', '2.o', '-c', '2.c'])
1117+
self.run_process([EMCC, '-flto', '-o', '1.o', '-c', '1.c'])
1118+
self.run_process([EMCC, '-flto', '-o', '2.o', '-c', '2.c'])
11191119
self.run_process([EMAR, 'crs', '2.a', '2.o'])
1120-
self.run_process([EMCC, '-r', '-o', 'out.o', '-Wl,--start-group', '2.a', '1.o', '-Wl,--end-group'])
1120+
self.run_process([EMCC, '-r', '-flto', '-o', 'out.o', '-Wl,--start-group', '2.a', '1.o', '-Wl,--end-group'])
11211121
self.run_process([EMCC, 'out.o'])
11221122
self.assertContained('Hello', self.run_js('a.out.js'))
11231123

@@ -3848,9 +3848,10 @@ def test_bc_to_bc(self):
38483848
# e.g. they assume our 'executable' extension is bc, and compile an .o to a .bc
38493849
# (the user would then need to build bc to js of course, but we need to actually
38503850
# emit the bc)
3851-
self.run_process([EMCC, '-c', test_file('hello_world.c')])
3851+
self.run_process([EMCC, '-flto', '-c', test_file('hello_world.c')])
38523852
self.assertExists('hello_world.o')
3853-
self.run_process([EMCC, '-r', 'hello_world.o', '-o', 'hello_world.bc'])
3853+
err = self.run_process([EMCC, '-flto', '-r', 'hello_world.o', '-o', 'hello_world.bc'], stderr=PIPE).stderr
3854+
self.assertContained('emcc: warning: bitcode linking with llvm-link is deprecated', err)
38543855
self.assertExists('hello_world.o')
38553856
self.assertExists('hello_world.bc')
38563857

tools/building.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@ def link_lld(args, target, external_symbols=None):
398398

399399

400400
def link_bitcode(args, target, force_archive_contents=False):
401+
diagnostics.warning('deprecated', 'bitcode linking with llvm-link is deprecated. Please use emar archives instead. See https://github.com/emscripten-core/emscripten/issues/13492')
401402
# "Full-featured" linking: looks into archives (duplicates lld functionality)
402403
input_files = [a for a in args if not a.startswith('-')]
403404
files_to_link = []

0 commit comments

Comments
 (0)