History

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

seyko committed 11 years ago

Commit 576aeb31 parent 2ba219f2 files · +5 −4Browse files

Unified · Split

2 files
  1. libtcc.c +5 −1
  2. tcc.c +0 −3
libtcc.c+5−1
@@ -2057,10 +2057,14 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv) · 2056 unmodified lines
20572057 }
20582058 }
20592059
2060+ if (s->output_type == 0)
2061+ s->output_type = TCC_OUTPUT_EXE;
2062+
20602063 if (pthread && s->output_type != TCC_OUTPUT_OBJ)
20612064 tcc_set_options(s, "-lpthread");
20622065
2063− tcc_set_linker(s, (const char *)linker_arg.data);
2066+ if (s->output_type == TCC_OUTPUT_EXE)
2067+ tcc_set_linker(s, (const char *)linker_arg.data);
20642068 cstr_free(&linker_arg);
20652069
20662070 return optind;
tcc.c+0−3
@@ -264,9 +264,6 @@ int main(int argc, char **argv) · 263 unmodified lines
264264 return 1;
265265 }
266266
267− if (s->output_type == 0)
268− s->output_type = TCC_OUTPUT_EXE;
269−
270267 if (s->option_m)
271268 exec_other_tcc(s, argv, s->option_m);
272269