fix "tcc test.c -Wl,,--oformat,binary"
set linker options only when "s->output_type == TCC_OUTPUT_EXE" otherwise tcc will produce a wrong object file
This commit is contained in:
parent
2ba219f781
commit
576aeb3aa9
2 changed files with 5 additions and 4 deletions
4
libtcc.c
4
libtcc.c
|
@ -2057,9 +2057,13 @@ 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)
|
if (pthread && s->output_type != TCC_OUTPUT_OBJ)
|
||||||
tcc_set_options(s, "-lpthread");
|
tcc_set_options(s, "-lpthread");
|
||||||
|
|
||||||
|
if (s->output_type == TCC_OUTPUT_EXE)
|
||||||
tcc_set_linker(s, (const char *)linker_arg.data);
|
tcc_set_linker(s, (const char *)linker_arg.data);
|
||||||
cstr_free(&linker_arg);
|
cstr_free(&linker_arg);
|
||||||
|
|
||||||
|
|
3
tcc.c
3
tcc.c
|
@ -264,9 +264,6 @@ int main(int argc, char **argv)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->output_type == 0)
|
|
||||||
s->output_type = TCC_OUTPUT_EXE;
|
|
||||||
|
|
||||||
if (s->option_m)
|
if (s->option_m)
|
||||||
exec_other_tcc(s, argv, s->option_m);
|
exec_other_tcc(s, argv, s->option_m);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue