Skip to content

Commit f366318

Browse files
committed
Remove check for file type of .a files. NFC
Instead just pass them through the linker like other inputs. See #21128
1 parent 64feaf1 commit f366318

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

emcc.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
from tools.shared import unsuffixed, unsuffixed_basename, get_file_suffix
4040
from tools.shared import run_process, exit_with_error, DEBUG
4141
from tools.shared import in_temp, OFormat
42-
from tools.shared import DYNAMICLIB_ENDINGS, STATICLIB_ENDINGS
42+
from tools.shared import DYNAMICLIB_ENDINGS
4343
from tools.response_file import substitute_response_files
4444
from tools import config
4545
from tools import cache
@@ -755,12 +755,6 @@ def phase_setup(options, state, newargs):
755755
file_suffix = get_file_suffix(arg)
756756
if file_suffix in HEADER_ENDINGS:
757757
has_header_inputs = True
758-
if file_suffix in STATICLIB_ENDINGS and not building.is_ar(arg):
759-
if building.is_bitcode(arg):
760-
message = f'{arg}: File has a suffix of a static library {STATICLIB_ENDINGS}, but instead is an LLVM bitcode file! When linking LLVM bitcode files use .bc or .o.'
761-
else:
762-
message = arg + ': Unknown format, not a static library!'
763-
exit_with_error(message)
764758
input_files.append((i, arg))
765759
elif arg.startswith('-L'):
766760
state.add_link_flag(i, arg)

test/test_other.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,10 @@ def test_bc_output_warning(self):
512512
err = self.run_process([EMCC, '-c', test_file('hello_world.c'), '-o', 'out.bc'], stderr=PIPE).stderr
513513
self.assertContained('emcc: warning: .bc output file suffix used without -flto or -emit-llvm', err)
514514

515+
def test_bc_as_archive(self):
516+
self.run_process([EMCC, '-c', test_file('hello_world.c'), '-flto', '-o', 'out.a'])
517+
self.run_process([EMCC, 'out.a'])
518+
515519
@parameterized({
516520
'c': [EMCC, '.c'],
517521
'cxx': [EMXX, '.cpp']

0 commit comments

Comments
 (0)