Skip to content

Commit

Permalink
Remove check for file type of .a files. NFC (#21513)
Browse files Browse the repository at this point in the history
Instead just pass them through the linker like other inputs.

See #21128
  • Loading branch information
sbc100 authored Mar 12, 2024
1 parent 92cb07a commit dd53c6c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 1 addition & 7 deletions emcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down

0 comments on commit dd53c6c

Please sign in to comment.