From f366318eb054f2d8794f605330b77da47a124cd9 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Mon, 11 Mar 2024 15:42:18 -0700 Subject: [PATCH] Remove check for file type of `.a` files. NFC Instead just pass them through the linker like other inputs. See #21128 --- emcc.py | 8 +------- test/test_other.py | 4 ++++ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/emcc.py b/emcc.py index 0b1a96370771..a98f33c33cc7 100644 --- a/emcc.py +++ b/emcc.py @@ -39,7 +39,7 @@ from tools.shared import unsuffixed, unsuffixed_basename, get_file_suffix from tools.shared import run_process, exit_with_error, DEBUG from tools.shared import in_temp, OFormat -from tools.shared import DYNAMICLIB_ENDINGS, STATICLIB_ENDINGS +from tools.shared import DYNAMICLIB_ENDINGS from tools.response_file import substitute_response_files from tools import config from tools import cache @@ -755,12 +755,6 @@ def phase_setup(options, state, newargs): file_suffix = get_file_suffix(arg) if file_suffix in HEADER_ENDINGS: has_header_inputs = True - if file_suffix in STATICLIB_ENDINGS and not building.is_ar(arg): - if building.is_bitcode(arg): - 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.' - else: - message = arg + ': Unknown format, not a static library!' - exit_with_error(message) input_files.append((i, arg)) elif arg.startswith('-L'): state.add_link_flag(i, arg) diff --git a/test/test_other.py b/test/test_other.py index fc2507091312..9e23d8ba8264 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -512,6 +512,10 @@ def test_bc_output_warning(self): err = self.run_process([EMCC, '-c', test_file('hello_world.c'), '-o', 'out.bc'], stderr=PIPE).stderr self.assertContained('emcc: warning: .bc output file suffix used without -flto or -emit-llvm', err) + def test_bc_as_archive(self): + self.run_process([EMCC, '-c', test_file('hello_world.c'), '-flto', '-o', 'out.a']) + self.run_process([EMCC, 'out.a']) + @parameterized({ 'c': [EMCC, '.c'], 'cxx': [EMXX, '.cpp']