Skip to content

Commit 23d7d65

Browse files
authored
Add support for thin ar archives (#14324)
Fixes: #14261
1 parent adc2495 commit 23d7d65

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

tests/test_other.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7622,6 +7622,13 @@ def test_archive_non_objects(self):
76227622
self.run_process([EMAR, 'crS', '--format=gnu', 'libfoo.a', 'file.txt', 'hello_world.o'])
76237623
self.run_process([EMCC, test_file('hello_world.c'), 'libfoo.a'])
76247624

7625+
def test_archive_thin(self):
7626+
self.run_process([EMCC, '-c', test_file('hello_world.c')])
7627+
# The `T` flag means "thin"
7628+
self.run_process([EMAR, 'crT', 'libhello.a', 'hello_world.o'])
7629+
self.run_process([EMCC, 'libhello.a'])
7630+
self.assertContained('hello, world!', self.run_js('a.out.js'))
7631+
76257632
def test_flag_aliases(self):
76267633
def assert_aliases_match(flag1, flag2, flagarg, extra_args=[]):
76277634
results = {}

tools/building.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1287,7 +1287,7 @@ def is_ar(filename):
12871287
if _is_ar_cache.get(filename):
12881288
return _is_ar_cache[filename]
12891289
header = open(filename, 'rb').read(8)
1290-
sigcheck = header == b'!<arch>\n'
1290+
sigcheck = header in (b'!<arch>\n', b'!<thin>\n')
12911291
_is_ar_cache[filename] = sigcheck
12921292
return sigcheck
12931293
except Exception as e:

0 commit comments

Comments
 (0)