File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -239,12 +239,23 @@ int main(int argc, char **argv) {
239
239
lcc_string_destroy (& args_before );
240
240
return 1 ;
241
241
}
242
-
242
+
243
243
/* Find the source file */
244
244
lcc_source_t source ;
245
245
if (!lcc_source_find (argc , argv , & source )) {
246
- lcc_error ("Couldn't find source file on command line" );
247
- goto find_error ;
246
+ /* If there isn't any source file on the command line it means
247
+ * the compiler is being used to invoke the linker.
248
+ */
249
+ lcc_string_destroy (& args_after );
250
+ lcc_string_appendf (& args_before , "%s" , cc );
251
+ for (int i = 0 ; i < argc ; i ++ ) {
252
+ if (!lcc_string_appendf (& args_before , " %s" , argv [i ]))
253
+ goto args_oom ;
254
+ }
255
+
256
+ int attempt = system (args_before .buffer );
257
+ lcc_string_destroy (& args_before );
258
+ return attempt ;
248
259
}
249
260
250
261
/* Find the output file */
@@ -309,9 +320,7 @@ int main(int argc, char **argv) {
309
320
lcc_string_destroy (& shell );
310
321
args_oom :
311
322
lcc_error ("Out of memory" );
312
- find_error :
313
323
lcc_string_destroy (& args_before );
314
324
lcc_string_destroy (& args_after );
315
325
return 1 ;
316
326
}
317
-
You can’t perform that action at this time.
0 commit comments