@@ -146,6 +146,10 @@ def decorated(self, *args, **kwargs):
146
146
return decorated
147
147
148
148
149
+ def llvm_nm (file ):
150
+ return building .llvm_nm_multiple ([file ])[0 ]
151
+
152
+
149
153
class other (RunnerCore ):
150
154
def assertIsObjectFile (self , filename ):
151
155
self .assertTrue (building .is_wasm (filename ))
@@ -342,7 +346,7 @@ def test_emcc_2(self, compiler, suffix):
342
346
self .clear ()
343
347
self .run_process ([compiler , '-c' , test_file ('hello_world' + suffix )] + args )
344
348
self .assertIsObjectFile (target )
345
- syms = building . llvm_nm (target )
349
+ syms = llvm_nm (target )
346
350
self .assertIn ('main' , syms ['defs' ])
347
351
# we also expect to have the '__original_main' wrapper and __main_void alias.
348
352
# TODO(sbc): Should be 4 once https://reviews.llvm.org/D75277 lands
@@ -518,7 +522,7 @@ def test_combining_object_files(self):
518
522
self .assertContained ('warning: object file output extension (.o) used for non-object output' , err )
519
523
520
524
# 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' )
522
526
self .assertIn ('main' , syms ['defs' ])
523
527
# TODO(sbc): Should be 4 once https://reviews.llvm.org/D75277 lands
524
528
self .assertIn (len (syms ['defs' ]), (4 , 3 ))
@@ -541,7 +545,7 @@ def test_combining_object_files_from_archive(self):
541
545
self .assertIsObjectFile ('combined.o' )
542
546
543
547
# 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' )
545
549
self .assertIn ('main' , syms ['defs' ])
546
550
# TODO(sbc): Should be 3 once https://reviews.llvm.org/D75277 lands
547
551
self .assertIn (len (syms ['defs' ]), (3 , 4 ))
@@ -4139,17 +4143,14 @@ def test_symbol_map_output_size(self, args):
4139
4143
self .assertEqual (os .path .getsize ('test1.js' ), os .path .getsize ('test2.js' ))
4140
4144
self .assertEqual (os .path .getsize ('test1.wasm' ), os .path .getsize ('test2.wasm' ))
4141
4145
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.
4147
4149
self .run_process ([EMCC , '-flto' , '-c' , test_file ('hello_world.c' )])
4148
4150
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' )
4153
4154
4154
4155
@parameterized ({
4155
4156
'' : (True , False ),
0 commit comments