|
35 | 35 | from . import webassembly |
36 | 36 | from .utils import read_file, read_binary, write_file, delete_file |
37 | 37 | from .utils import removeprefix, exit_with_error |
38 | | -from .shared import in_temp, safe_copy, do_replace, run_process, OFormat |
| 38 | +from .shared import in_temp, safe_copy, do_replace, OFormat |
39 | 39 | from .shared import DEBUG, WINDOWS, DYNAMICLIB_ENDINGS, STATICLIB_ENDINGS |
40 | 40 | from .shared import unsuffixed, unsuffixed_basename, get_file_suffix |
41 | 41 | from .settings import settings, default_setting, user_settings, JS_ONLY_SETTINGS |
@@ -201,38 +201,6 @@ def embed_memfile(options): |
201 | 201 | not settings.GENERATE_SOURCE_MAP))) |
202 | 202 |
|
203 | 203 |
|
204 | | -def is_ar_file_with_missing_index(archive_file): |
205 | | - # We parse the archive header outselves because llvm-nm --print-armap is slower and less |
206 | | - # reliable. |
207 | | - # See: https://github.com/emscripten-core/emscripten/issues/10195 |
208 | | - archive_header = b'!<arch>\n' |
209 | | - file_header_size = 60 |
210 | | - |
211 | | - with open(archive_file, 'rb') as f: |
212 | | - header = f.read(len(archive_header)) |
213 | | - if header != archive_header: |
214 | | - # This is not even an ar file |
215 | | - return False |
216 | | - file_header = f.read(file_header_size) |
217 | | - if len(file_header) != file_header_size: |
218 | | - # We don't have any file entires at all so we don't consider the index missing |
219 | | - return False |
220 | | - |
221 | | - name = file_header[:16].strip() |
222 | | - # If '/' is the name of the first file we have an index |
223 | | - return name != b'/' |
224 | | - |
225 | | - |
226 | | -def ensure_archive_index(archive_file): |
227 | | - # Fastcomp linking works without archive indexes. |
228 | | - if not settings.AUTO_ARCHIVE_INDEXES: |
229 | | - return |
230 | | - if is_ar_file_with_missing_index(archive_file): |
231 | | - diagnostics.warning('emcc', '%s: archive is missing an index; Use emar when creating libraries to ensure an index is created', archive_file) |
232 | | - diagnostics.warning('emcc', '%s: adding index', archive_file) |
233 | | - run_process([shared.LLVM_RANLIB, archive_file]) |
234 | | - |
235 | | - |
236 | 204 | def generate_js_sym_info(): |
237 | 205 | # Runs the js compiler to generate a list of all symbols available in the JS |
238 | 206 | # libraries. This must be done separately for each linker invokation since the |
@@ -903,7 +871,6 @@ def phase_linker_setup(options, state, newargs): |
903 | 871 | default_setting('DEFAULT_TO_CXX', 0) |
904 | 872 | default_setting('AUTO_JS_LIBRARIES', 0) |
905 | 873 | default_setting('AUTO_NATIVE_LIBRARIES', 0) |
906 | | - default_setting('AUTO_ARCHIVE_INDEXES', 0) |
907 | 874 | default_setting('IGNORE_MISSING_MAIN', 0) |
908 | 875 | default_setting('ALLOW_UNIMPLEMENTED_SYSCALLS', 0) |
909 | 876 | if options.oformat == OFormat.HTML and options.shell_path == DEFAULT_SHELL_HTML: |
@@ -2696,10 +2663,6 @@ def process_libraries(state, linker_inputs): |
2696 | 2663 | settings.JS_LIBRARIES = [lib[1] for lib in settings.JS_LIBRARIES] |
2697 | 2664 | state.link_flags = new_flags |
2698 | 2665 |
|
2699 | | - for _, f in linker_inputs: |
2700 | | - if building.is_ar(f): |
2701 | | - ensure_archive_index(f) |
2702 | | - |
2703 | 2666 |
|
2704 | 2667 | class ScriptSource: |
2705 | 2668 | def __init__(self): |
|
0 commit comments