--- a/emcc.py 2019-08-13 20:07:34.000000000 -0500 +++ b/emcc.py 2019-08-27 08:05:39.000000000 -0500 @@ -890,6 +890,9 @@ lib_dirs = [shared.path_from_root('system', 'local', 'lib'), shared.path_from_root('system', 'lib')] + # -c mean compile to object files(s), don't link + has_dash_c = '-c' in newargs + # find input files this a simple heuristic. we should really analyze # based on a full understanding of gcc params, right now we just assume that # what is left contains no more |-x OPT| things @@ -915,7 +918,7 @@ 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 newargs[i] = '' - if file_suffix.endswith(SOURCE_ENDINGS): + if file_suffix.endswith(SOURCE_ENDINGS) or (has_dash_c and file_suffix.endswith(BITCODE_ENDINGS)): input_files.append((i, arg)) has_source_inputs = True elif file_suffix.endswith(HEADER_ENDINGS): @@ -984,7 +987,6 @@ newargs = [a for a in newargs if a != ''] - has_dash_c = '-c' in newargs has_dash_S = '-S' in newargs if has_dash_c or has_dash_S: assert has_source_inputs or has_header_inputs, 'Must have source code or header inputs to use -c or -S' @@ -1838,7 +1840,7 @@ # First, generate LLVM bitcode. For each input file, we get base.o with bitcode for i, input_file in input_files: file_ending = get_file_suffix(input_file) - if file_ending.endswith(SOURCE_ENDINGS): + if file_ending.endswith(SOURCE_ENDINGS) or (has_dash_c and file_ending.endswith(BITCODE_ENDINGS)): compile_source_file(i, input_file) else: # bitcode if file_ending.endswith(BITCODE_ENDINGS):