Skip to content

Commit ca972e1

Browse files
authored
Remove bitcode linking capability (#17858)
This feature has been deprecated since 3.0.1 (~9 months now) an we haven't heard of anyone wanting to keep it around. Removing this features removes a lot of extra code and complexity that was not being used (as far we we know). Fixes: #13492
1 parent 7fc5956 commit ca972e1

File tree

4 files changed

+31
-286
lines changed

4 files changed

+31
-286
lines changed

ChangeLog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ See docs/process.md for more on how version tagging works.
2323
- The `__EMSCRIPTEN_major__/minor__/tiny__` macros are no longer defined on the
2424
command line but require `<emscripten.h/>` (or just `<emscripten/version.h>`
2525
to be included. (#17883)
26+
- Linking of bitcode files using `emcc -r` + `-flto` is no longer supported.
27+
`emcc -r` will now always use lld to link to an object file. This matches the
28+
behavior of upstream llvm where bitcode linking using lld does not exist.
29+
The recommend way to combine bitcode input is to use library files (`ar`
30+
archives). See #13492 for more details.
2631

2732
3.1.22 - 09/19/22
2833
-----------------

test/test_other.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,10 @@ def decorated(self, *args, **kwargs):
146146
return decorated
147147

148148

149+
def llvm_nm(file):
150+
return building.llvm_nm_multiple([file])[0]
151+
152+
149153
class other(RunnerCore):
150154
def assertIsObjectFile(self, filename):
151155
self.assertTrue(building.is_wasm(filename))
@@ -342,7 +346,7 @@ def test_emcc_2(self, compiler, suffix):
342346
self.clear()
343347
self.run_process([compiler, '-c', test_file('hello_world' + suffix)] + args)
344348
self.assertIsObjectFile(target)
345-
syms = building.llvm_nm(target)
349+
syms = llvm_nm(target)
346350
self.assertIn('main', syms['defs'])
347351
# we also expect to have the '__original_main' wrapper and __main_void alias.
348352
# TODO(sbc): Should be 4 once https://reviews.llvm.org/D75277 lands
@@ -518,7 +522,7 @@ def test_combining_object_files(self):
518522
self.assertContained('warning: object file output extension (.o) used for non-object output', err)
519523

520524
# Should be two symbols (and in the wasm backend, also __original_main)
521-
syms = building.llvm_nm('combined.o')
525+
syms = llvm_nm('combined.o')
522526
self.assertIn('main', syms['defs'])
523527
# TODO(sbc): Should be 4 once https://reviews.llvm.org/D75277 lands
524528
self.assertIn(len(syms['defs']), (4, 3))
@@ -541,7 +545,7 @@ def test_combining_object_files_from_archive(self):
541545
self.assertIsObjectFile('combined.o')
542546

543547
# Should be two symbols (and in the wasm backend, also __original_main)
544-
syms = building.llvm_nm('combined.o')
548+
syms = llvm_nm('combined.o')
545549
self.assertIn('main', syms['defs'])
546550
# TODO(sbc): Should be 3 once https://reviews.llvm.org/D75277 lands
547551
self.assertIn(len(syms['defs']), (3, 4))
@@ -4139,17 +4143,14 @@ def test_symbol_map_output_size(self, args):
41394143
self.assertEqual(os.path.getsize('test1.js'), os.path.getsize('test2.js'))
41404144
self.assertEqual(os.path.getsize('test1.wasm'), os.path.getsize('test2.wasm'))
41414145

4142-
def test_bc_to_bc(self):
4143-
# emcc should 'process' bitcode to bitcode. build systems can request this if
4144-
# e.g. they assume our 'executable' extension is bc, and compile an .o to a .bc
4145-
# (the user would then need to build bc to js of course, but we need to actually
4146-
# emit the bc)
4146+
def test_bitcode_linking(self):
4147+
# emcc used to be able to link bitcode together, but these days partial linking
4148+
# always outputs an object file.
41474149
self.run_process([EMCC, '-flto', '-c', test_file('hello_world.c')])
41484150
self.assertExists('hello_world.o')
4149-
err = self.run_process([EMCC, '-flto', '-r', 'hello_world.o', '-o', 'hello_world.bc'], stderr=PIPE).stderr
4150-
self.assertContained('emcc: warning: bitcode linking with llvm-link is deprecated', err)
4151-
self.assertExists('hello_world.o')
4152-
self.assertExists('hello_world.bc')
4151+
self.run_process([EMCC, '-flto', '-r', 'hello_world.o', '-o', 'hello_world2.o'])
4152+
building.is_bitcode('hello_world.o')
4153+
building.is_wasm('hello_world2.o')
41534154

41544155
@parameterized({
41554156
'': (True, False),

0 commit comments

Comments
 (0)