diff --git a/libtcc.c b/libtcc.c index a14cd5f..f0dbe75 100644 --- a/libtcc.c +++ b/libtcc.c @@ -2057,10 +2057,14 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv) } } + if (s->output_type == 0) + s->output_type = TCC_OUTPUT_EXE; + if (pthread && s->output_type != TCC_OUTPUT_OBJ) tcc_set_options(s, "-lpthread"); - tcc_set_linker(s, (const char *)linker_arg.data); + if (s->output_type == TCC_OUTPUT_EXE) + tcc_set_linker(s, (const char *)linker_arg.data); cstr_free(&linker_arg); return optind; diff --git a/tcc.c b/tcc.c index aacbd42..a0b1c70 100644 --- a/tcc.c +++ b/tcc.c @@ -264,9 +264,6 @@ int main(int argc, char **argv) return 1; } - if (s->output_type == 0) - s->output_type = TCC_OUTPUT_EXE; - if (s->option_m) exec_other_tcc(s, argv, s->option_m);