Skip to content

Commit 9bb322f

Browse files
authored
Remove zeroes binary from test_archive_non_objects (#12419)
This test was added in #10300 to check if we can handle non-objects in archives, especially rust metadata files that start with two leading zeroes. LLVM's file magic identifier thinks files with two leading zeroes are COFF files. But Rust metadata files used to start with two leading zeroes too, resulting in an error in LLVM tools. So #10300 bypassed use of `llvm-nm` to avoid that. We were still using `llvm-ranlib`, which also ran the LLVM magic identifier when trying to create a symbol table for an object, but `llvm-ranlib` so far has ignored those errors. But recently llvm/llvm-project@a20168d made them explicit errors, so we couldn't run `llvm-ranlib` anymore with archives containing objects that start with two leading zeroes. But this is not relevant anymore because Rust fixed their object file format in rust-lang/rust#66235, so their files are not mistaken by LLVM for COFF files anymore. So this PR fixes this test to not include a binary with two leading zeros, while still testing archival of non-object files.
1 parent 22c03b5 commit 9bb322f

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

tests/test_other.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -7154,14 +7154,11 @@ def test_archive_no_index(self):
71547154

71557155
def test_archive_non_objects(self):
71567156
create_test_file('file.txt', 'test file')
7157-
# llvm-nm has issues with files that start with two or more null bytes since it thinks they
7158-
# are COFF files. Ensure that we correctly ignore such files when we process them.
7159-
create_test_file('zeros.bin', '\0\0\0\0')
71607157
self.run_process([EMCC, '-c', path_from_root('tests', 'hello_world.c')])
71617158
# No index added.
71627159
# --format=darwin (the default on OSX has a strange issue where it add extra
71637160
# newlines to files: https://bugs.llvm.org/show_bug.cgi?id=42562
7164-
self.run_process([EMAR, 'crS', '--format=gnu', 'libfoo.a', 'file.txt', 'zeros.bin', 'hello_world.o'])
7161+
self.run_process([EMAR, 'crS', '--format=gnu', 'libfoo.a', 'file.txt', 'hello_world.o'])
71657162
self.run_process([EMCC, path_from_root('tests', 'hello_world.c'), 'libfoo.a'])
71667163

71677164
def test_flag_aliases(self):

0 commit comments

Comments
 (0)