diff --git a/emcc.py b/emcc.py index 0ed9f9895738a..344e9e71ce79f 100755 --- a/emcc.py +++ b/emcc.py @@ -66,7 +66,7 @@ C_ENDINGS = C_ENDINGS + SPECIAL_ENDINGLESS_FILENAMES # consider the special endingless filenames like /dev/null to be C JS_CONTAINING_ENDINGS = ('.js', '.mjs', '.html') -BITCODE_ENDINGS = ('.bc', '.o', '.obj', '.lo') +OBJECT_FILE_ENDINGS = ('.bc', '.o', '.obj', '.lo') DYNAMICLIB_ENDINGS = ('.dylib', '.so') # Windows .dll suffix is not included in this list, since those are never linked to directly on the command line. STATICLIB_ENDINGS = ('.a',) ASSEMBLY_ENDINGS = ('.ll',) @@ -729,7 +729,7 @@ def filter_emscripten_options(argv): if target.endswith('.js'): shutil.copyfile(target, unsuffixed(target)) target = unsuffixed(target) - if not target.endswith(BITCODE_ENDINGS): + if not target.endswith(OBJECT_FILE_ENDINGS): src = open(target).read() full_node = ' '.join(shared.NODE_JS) if os.path.sep not in full_node: @@ -928,7 +928,7 @@ def optimizing(opts): '-current_version', '-I', '-L', '-include-pch'): continue # ignore this gcc-style argument - if options.expand_symlinks and os.path.islink(arg) and get_file_suffix(os.path.realpath(arg)) in SOURCE_ENDINGS + BITCODE_ENDINGS + DYNAMICLIB_ENDINGS + ASSEMBLY_ENDINGS + HEADER_ENDINGS: + if options.expand_symlinks and os.path.islink(arg) and get_file_suffix(os.path.realpath(arg)) in SOURCE_ENDINGS + OBJECT_FILE_ENDINGS + DYNAMICLIB_ENDINGS + ASSEMBLY_ENDINGS + HEADER_ENDINGS: arg = os.path.realpath(arg) if not arg.startswith('-'): @@ -936,7 +936,7 @@ def optimizing(opts): exit_with_error('%s: No such file or directory ("%s" was expected to be an input file, based on the commandline arguments provided)', arg, arg) file_suffix = get_file_suffix(arg) - if file_suffix in SOURCE_ENDINGS + BITCODE_ENDINGS + DYNAMICLIB_ENDINGS + ASSEMBLY_ENDINGS + HEADER_ENDINGS or shared.Building.is_ar(arg): # we already removed -o , so all these should be inputs + if file_suffix in SOURCE_ENDINGS + OBJECT_FILE_ENDINGS + DYNAMICLIB_ENDINGS + ASSEMBLY_ENDINGS + HEADER_ENDINGS or shared.Building.is_ar(arg): # we already removed -o , so all these should be inputs newargs[i] = '' if file_suffix.endswith(SOURCE_ENDINGS): input_files.append((i, arg)) @@ -966,7 +966,7 @@ def optimizing(opts): elif file_suffix.endswith(STATICLIB_ENDINGS): if not shared.Building.is_ar(arg): if shared.Building.is_bitcode(arg): - message = arg + ': File has a suffix of a static library ' + str(STATICLIB_ENDINGS) + ', but instead is an LLVM bitcode file! When linking LLVM bitcode files, use one of the suffixes ' + str(BITCODE_ENDINGS) + message = arg + ': File has a suffix of a static library ' + str(STATICLIB_ENDINGS) + ', but instead is an LLVM bitcode file! When linking LLVM bitcode files, use one of the suffixes ' + str(OBJECT_FILE_ENDINGS) else: message = arg + ': Unknown format, not a static library!' exit_with_error(message) @@ -1083,7 +1083,7 @@ def check(input_file): input_files = filter_out_dynamic_libs(input_files) if len(input_files) == 0: - exit_with_error('no input files\nnote that input files without a known suffix are ignored, make sure your input files end with one of: ' + str(SOURCE_ENDINGS + BITCODE_ENDINGS + DYNAMICLIB_ENDINGS + STATICLIB_ENDINGS + ASSEMBLY_ENDINGS + HEADER_ENDINGS)) + exit_with_error('no input files\nnote that input files without a known suffix are ignored, make sure your input files end with one of: ' + str(SOURCE_ENDINGS + OBJECT_FILE_ENDINGS + DYNAMICLIB_ENDINGS + STATICLIB_ENDINGS + ASSEMBLY_ENDINGS + HEADER_ENDINGS)) newargs = shared.COMPILER_OPTS + shared.get_cflags(newargs) + newargs @@ -1887,9 +1887,9 @@ def compile_source_file(i, input_file): file_ending = get_file_suffix(input_file) if file_ending.endswith(SOURCE_ENDINGS): compile_source_file(i, input_file) - else: # bitcode - if file_ending.endswith(BITCODE_ENDINGS): - logger.debug('using bitcode file: ' + input_file) + else: + if file_ending.endswith(OBJECT_FILE_ENDINGS): + logger.debug('using object file: ' + input_file) temp_files.append((i, input_file)) elif file_ending.endswith(DYNAMICLIB_ENDINGS) or shared.Building.is_ar(input_file): logger.debug('using library file: ' + input_file) @@ -2045,7 +2045,7 @@ def get_final(): # First, combine the bitcode files if there are several. We must also link if we have a singleton .a perform_link = len(linker_inputs) > 1 or shared.Settings.WASM_BACKEND if not perform_link and not LEAVE_INPUTS_RAW: - is_bc = suffix(temp_files[0][1]) in BITCODE_ENDINGS + is_bc = suffix(temp_files[0][1]) in OBJECT_FILE_ENDINGS is_dylib = suffix(temp_files[0][1]) in DYNAMICLIB_ENDINGS is_ar = shared.Building.is_ar(temp_files[0][1]) perform_link = not (is_bc or is_dylib) and is_ar