History

Re-enable "Use CString to concat linker options"

This reverts commit 16202e054f0385499ec16463b87e23c97dc02328. Changed win32 build to use ONE_SOURCE just like libtcc.dll Therefore CString can be used again...

Gabriel Corneanu committed 14 years ago

Commit 214564b1 parent 176876e2 files · +9 −14Browse files

Unified · Split

2 files
  1. tcc.c +8 −13
  2. win32/build-tcc.bat +1 −1
tcc.c+8−13
@@ -35,7 +35,7 @@ static int do_bench = 0; · 34 unmodified lines
35static int gen_deps;35static int gen_deps;
36static const char *deps_outfile;36static const char *deps_outfile;
37static const char *m_option;37static const char *m_option;
38static char *linker_arg;38static CString linker_arg;
39 39
40#define TCC_OPTION_HAS_ARG 0x000140#define TCC_OPTION_HAS_ARG 0x0001
41#define TCC_OPTION_NOSEP 0x0002 /* cannot have space before option and arg */41#define TCC_OPTION_NOSEP 0x0002 /* cannot have space before option and arg */
@@ -281,11 +281,11 @@ static int parse_args(TCCState *s, int argc, char **argv) · 239 unmodified lines
281 const char *optarg, *p1, *r1;281 const char *optarg, *p1, *r1;
282 char *r;282 char *r;
283 int was_pthread;283 int was_pthread;
284 unsigned long linker_argsize = 0;
285 284
286 was_pthread = 0; /* is set if commandline contains -pthread key */285 was_pthread = 0; /* is set if commandline contains -pthread key */
287 286
288 optind = 1;287 optind = 1;
288 cstr_new(&linker_arg);
289 while (optind < argc) {289 while (optind < argc) {
290 290
291 r = argv[optind++];291 r = argv[optind++];
@@ -444,16 +444,11 @@ static int parse_args(TCCState *s, int argc, char **argv) · 152 unmodified lines
444 s->rdynamic = 1;444 s->rdynamic = 1;
445 break;445 break;
446 case TCC_OPTION_Wl:446 case TCC_OPTION_Wl:
447 if (!linker_arg) {447 if (!linker_arg.data_allocated)
448 linker_argsize = strlen(optarg) + 1;448 cstr_cat(&linker_arg, optarg);
449 linker_arg = tcc_malloc(linker_argsize);
450 pstrcpy(linker_arg, linker_argsize, optarg);
451 }
452 else {449 else {
453 linker_argsize += strlen(optarg) + 1;450 cstr_ccat(&linker_arg, ',');
454 linker_arg = tcc_realloc(linker_arg, linker_argsize);451 cstr_cat(&linker_arg, optarg);
455 pstrcat(linker_arg, linker_argsize, ",");
456 pstrcat(linker_arg, linker_argsize, optarg);
457 }452 }
458 break;453 break;
459 case TCC_OPTION_E:454 case TCC_OPTION_E:
@@ -476,7 +471,7 @@ static int parse_args(TCCState *s, int argc, char **argv) · 16 unmodified lines
476 }471 }
477 }472 }
478 }473 }
479 if ((r = (char *) tcc_set_linker(s, (char *)linker_arg, TRUE)))474 if ((r = (char *) tcc_set_linker(s, (char *) linker_arg.data, TRUE)))
480 tcc_error("unsupported linker option '%s'", r);475 tcc_error("unsupported linker option '%s'", r);
481 /* fixme: these options could be different on your platform */476 /* fixme: these options could be different on your platform */
482 if (was_pthread && output_type != TCC_OUTPUT_OBJ) {477 if (was_pthread && output_type != TCC_OUTPUT_OBJ) {
@@ -610,7 +605,7 @@ int main(int argc, char **argv) · 127 unmodified lines
610 }605 }
611 606
612 tcc_delete(s);607 tcc_delete(s);
613 tcc_free(linker_arg);608 cstr_free(&linker_arg);
614 tcc_free(outfile);609 tcc_free(outfile);
615 610
616#ifdef MEM_DEBUG611#ifdef MEM_DEBUG
win32/build-tcc.bat+1−1
@@ -34,7 +34,7 @@ copy ..\libtcc.h libtcc\libtcc.h · 33 unmodified lines
34tiny_impdef libtcc.dll -o lib/libtcc.def34tiny_impdef libtcc.dll -o lib/libtcc.def
35 35
36:tcc36:tcc
37%CC% %target% ../tcc.c -o tcc.exe -ltcc -Llibtcc37%CC% %target% -DONE_SOURCE ../tcc.c -o tcc.exe -ltcc -Llibtcc
38 38
39:copy_std_includes39:copy_std_includes
40copy ..\include\*.h include40copy ..\include\*.h include

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t