diff --git a/src/settings.js b/src/settings.js index 40a72586ad939..2ff477dba4f9a 100644 --- a/src/settings.js +++ b/src/settings.js @@ -1153,7 +1153,6 @@ var LINKABLE = false; // - IGNORE_MISSING_MAIN is disabled. // - AUTO_JS_LIBRARIES is disabled. // - AUTO_NATIVE_LIBRARIES is disabled. -// - AUTO_ARCHIVE_INDEXES is disabled. // - DEFAULT_TO_CXX is disabled. // - USE_GLFW is set to 0 rather than 2 by default. // - ALLOW_UNIMPLEMENTED_SYSCALLS is disabled. @@ -1168,13 +1167,6 @@ var STRICT = false; // [link] var IGNORE_MISSING_MAIN = true; -// Automatically attempt to add archive indexes at link time to archives that -// don't already have them. This can happen when GNU ar or GNU ranlib is used -// rather than ``llvm-ar`` or ``emar`` since the former don't understand the wasm -// object format. -// [link] -var AUTO_ARCHIVE_INDEXES = true; - // Add ``"use strict;"`` to generated JS // [link] var STRICT_JS = false; @@ -2188,4 +2180,5 @@ var LEGACY_SETTINGS = [ ['MIN_EDGE_VERSION', [0x7FFFFFFF], 'No longer supported'], ['MIN_IE_VERSION', [0x7FFFFFFF], 'No longer supported'], ['WORKAROUND_OLD_WEBGL_UNIFORM_UPLOAD_IGNORED_OFFSET_BUG', [0], 'No longer supported'], + ['AUTO_ARCHIVE_INDEXES', [0, 1], 'No longer needed'], ]; diff --git a/test/test_other.py b/test/test_other.py index 9e6960aaf100c..919b003d07ee9 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -9121,22 +9121,6 @@ def test_response_file_bom(self): create_file('test.rsp', b'\xef\xbb\xbf--version', binary=True) self.run_process([EMCC, '@test.rsp']) - def test_archive_empty(self): - # This test added because we had an issue with the AUTO_ARCHIVE_INDEXES failing on empty - # archives (which inherently don't have indexes). - self.run_process([EMAR, 'crS', 'libfoo.a']) - self.run_process([EMCC, '-Werror', 'libfoo.a', test_file('hello_world.c')]) - - def test_archive_no_index(self): - create_file('foo.c', 'int foo = 1;') - self.run_process([EMCC, '-c', 'foo.c']) - self.run_process([EMCC, '-c', test_file('hello_world.c')]) - # The `S` flag means don't add an archive index - self.run_process([EMAR, 'crS', 'libfoo.a', 'foo.o']) - # wasm-ld supports archive files without an index (unlike GNU ld) as of - # https://github.com/llvm/llvm-project/pull/78821 - self.run_process([EMCC, 'libfoo.a', 'hello_world.o']) - def test_archive_non_objects(self): create_file('file.txt', 'test file') self.run_process([EMCC, '-c', test_file('hello_world.c')]) diff --git a/tools/link.py b/tools/link.py index 9e58b95e8fc28..dde914dcee949 100644 --- a/tools/link.py +++ b/tools/link.py @@ -201,38 +201,6 @@ def embed_memfile(options): not settings.GENERATE_SOURCE_MAP))) -def is_ar_file_with_missing_index(archive_file): - # We parse the archive header outselves because llvm-nm --print-armap is slower and less - # reliable. - # See: https://github.com/emscripten-core/emscripten/issues/10195 - archive_header = b'!\n' - file_header_size = 60 - - with open(archive_file, 'rb') as f: - header = f.read(len(archive_header)) - if header != archive_header: - # This is not even an ar file - return False - file_header = f.read(file_header_size) - if len(file_header) != file_header_size: - # We don't have any file entires at all so we don't consider the index missing - return False - - name = file_header[:16].strip() - # If '/' is the name of the first file we have an index - return name != b'/' - - -def ensure_archive_index(archive_file): - # Fastcomp linking works without archive indexes. - if not settings.AUTO_ARCHIVE_INDEXES: - return - if is_ar_file_with_missing_index(archive_file): - diagnostics.warning('emcc', '%s: archive is missing an index; Use emar when creating libraries to ensure an index is created', archive_file) - diagnostics.warning('emcc', '%s: adding index', archive_file) - run_process([shared.LLVM_RANLIB, archive_file]) - - def generate_js_sym_info(): # Runs the js compiler to generate a list of all symbols available in the JS # libraries. This must be done separately for each linker invokation since the @@ -2696,10 +2664,6 @@ def process_libraries(state, linker_inputs): settings.JS_LIBRARIES = [lib[1] for lib in settings.JS_LIBRARIES] state.link_flags = new_flags - for _, f in linker_inputs: - if building.is_ar(f): - ensure_archive_index(f) - class ScriptSource: def __init__(self):