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
2057 }2057 }
2058 }2058 }
2059 2059
2060 if (s->output_type == 0)
2061 s->output_type = TCC_OUTPUT_EXE;
2062
2060 if (pthread && s->output_type != TCC_OUTPUT_OBJ)2063 if (pthread && s->output_type != TCC_OUTPUT_OBJ)
2061 tcc_set_options(s, "-lpthread");2064 tcc_set_options(s, "-lpthread");
2062 2065
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);
2064 cstr_free(&linker_arg);2068 cstr_free(&linker_arg);
2065 2069
2066 return optind;2070 return optind;
tcc.c+0−3
@@ -264,9 +264,6 @@ int main(int argc, char **argv) · 263 unmodified lines
264 return 1;264 return 1;
265 }265 }
266 266
267 if (s->output_type == 0)
268 s->output_type = TCC_OUTPUT_EXE;
269
270 if (s->option_m)267 if (s->option_m)
271 exec_other_tcc(s, argv, s->option_m);268 exec_other_tcc(s, argv, s->option_m);
272 269