This is supposed to fix a bug where libtcc eventually was trying to compile libtcc1.a as C source code. Anyway, there is now only two functions that refer to s->filetype, tcc_add_file() and tcc_add_library().
Unified · Split
| @@ -621,14 +621,13 @@ ST_FUNC int tcc_open(TCCState *s1, const char *filename) · 620 unmodified lines | |||
| 621 | } | 621 | } |
| 622 | 622 | ||
| 623 | /* compile the file opened in 'file'. Return non zero if errors. */ | 623 | /* compile the file opened in 'file'. Return non zero if errors. */ |
| 624 | static int tcc_compile(TCCState *s1) | 624 | static int tcc_compile(TCCState *s1, int filetype) |
| 625 | { | 625 | { |
| 626 | Sym *define_start; | 626 | Sym *define_start; |
| 627 | int filetype, is_asm; | 627 | int is_asm; |
| 628 | 628 | ||
| 629 | define_start = define_stack; | 629 | define_start = define_stack; |
| 630 | filetype = s1->filetype; | 630 | is_asm = !!(filetype & (AFF_TYPE_ASM|AFF_TYPE_ASMPP)); |
| 631 | is_asm = filetype == AFF_TYPE_ASM || filetype == AFF_TYPE_ASMPP; | ||
| 632 | tccelf_begin_file(s1); | 631 | tccelf_begin_file(s1); |
| 633 | 632 | ||
| 634 | if (setjmp(s1->error_jmp_buf) == 0) { | 633 | if (setjmp(s1->error_jmp_buf) == 0) { |
| @@ -640,7 +639,7 @@ static int tcc_compile(TCCState *s1) · 5 unmodified lines | |||
| 640 | tcc_preprocess(s1); | 639 | tcc_preprocess(s1); |
| 641 | } else if (is_asm) { | 640 | } else if (is_asm) { |
| 642 | #ifdef CONFIG_TCC_ASM | 641 | #ifdef CONFIG_TCC_ASM |
| 643 | tcc_assemble(s1, filetype == AFF_TYPE_ASMPP); | 642 | tcc_assemble(s1, !!(filetype & AFF_TYPE_ASMPP)); |
| 644 | #else | 643 | #else |
| 645 | tcc_error_noabort("asm not supported"); | 644 | tcc_error_noabort("asm not supported"); |
| 646 | #endif | 645 | #endif |
| @@ -667,7 +666,7 @@ LIBTCCAPI int tcc_compile_string(TCCState *s, const char *str) · 20 unmodified lines | |||
| 667 | len = strlen(str); | 666 | len = strlen(str); |
| 668 | tcc_open_bf(s, "<string>", len); | 667 | tcc_open_bf(s, "<string>", len); |
| 669 | memcpy(file->buffer, str, len); | 668 | memcpy(file->buffer, str, len); |
| 670 | ret = tcc_compile(s); | 669 | ret = tcc_compile(s, s->filetype); |
| 671 | tcc_close(); | 670 | tcc_close(); |
| 672 | return ret; | 671 | return ret; |
| 673 | } | 672 | } |
| @@ -733,7 +732,6 @@ LIBTCCAPI TCCState *tcc_new(void) · 59 unmodified lines | |||
| 733 | tcc_state = s; | 732 | tcc_state = s; |
| 734 | ++nb_states; | 733 | ++nb_states; |
| 735 | 734 | ||
| 736 | s->alacarte_link = 1; | ||
| 737 | s->nocommon = 1; | 735 | s->nocommon = 1; |
| 738 | s->warn_implicit_function_declaration = 1; | 736 | s->warn_implicit_function_declaration = 1; |
| 739 | s->ms_extensions = 1; | 737 | s->ms_extensions = 1; |
| @@ -1042,7 +1040,7 @@ ST_FUNC int tcc_add_file_internal(TCCState *s1, const char *filename, int flags) · 302 unmodified lines | |||
| 1042 | break; | 1040 | break; |
| 1043 | #endif | 1041 | #endif |
| 1044 | case AFF_BINTYPE_AR: | 1042 | case AFF_BINTYPE_AR: |
| 1045 | ret = tcc_load_archive(s1, fd); | 1043 | ret = tcc_load_archive(s1, fd, !(flags & AFF_WHOLE_ARCHIVE)); |
| 1046 | break; | 1044 | break; |
| 1047 | #ifdef TCC_TARGET_COFF | 1045 | #ifdef TCC_TARGET_COFF |
| 1048 | case AFF_BINTYPE_C67: | 1046 | case AFF_BINTYPE_C67: |
| @@ -1061,7 +1059,7 @@ ST_FUNC int tcc_add_file_internal(TCCState *s1, const char *filename, int flags) · 12 unmodified lines | |||
| 1061 | break; | 1059 | break; |
| 1062 | } | 1060 | } |
| 1063 | } else { | 1061 | } else { |
| 1064 | ret = tcc_compile(s1); | 1062 | ret = tcc_compile(s1, flags); |
| 1065 | } | 1063 | } |
| 1066 | tcc_close(); | 1064 | tcc_close(); |
| 1067 | return ret; | 1065 | return ret; |
| @@ -1070,8 +1068,7 @@ ST_FUNC int tcc_add_file_internal(TCCState *s1, const char *filename, int flags) · 2 unmodified lines | |||
| 1070 | LIBTCCAPI int tcc_add_file(TCCState *s, const char *filename) | 1068 | LIBTCCAPI int tcc_add_file(TCCState *s, const char *filename) |
| 1071 | { | 1069 | { |
| 1072 | int filetype = s->filetype; | 1070 | int filetype = s->filetype; |
| 1073 | int flags = AFF_PRINT_ERROR; | 1071 | if (0 == (filetype & AFF_TYPE_MASK)) { |
| 1074 | if (filetype == 0) { | ||
| 1075 | /* use a file extension to detect a filetype */ | 1072 | /* use a file extension to detect a filetype */ |
| 1076 | const char *ext = tcc_fileextension(filename); | 1073 | const char *ext = tcc_fileextension(filename); |
| 1077 | if (ext[0]) { | 1074 | if (ext[0]) { |
| @@ -1083,13 +1080,12 @@ LIBTCCAPI int tcc_add_file(TCCState *s, const char *filename) · 5 unmodified lines | |||
| 1083 | else if (!PATHCMP(ext, "c") || !PATHCMP(ext, "i")) | 1080 | else if (!PATHCMP(ext, "c") || !PATHCMP(ext, "i")) |
| 1084 | filetype = AFF_TYPE_C; | 1081 | filetype = AFF_TYPE_C; |
| 1085 | else | 1082 | else |
| 1086 | flags |= AFF_TYPE_BIN; | 1083 | filetype |= AFF_TYPE_BIN; |
| 1087 | } else { | 1084 | } else { |
| 1088 | filetype = AFF_TYPE_C; | 1085 | filetype = AFF_TYPE_C; |
| 1089 | } | 1086 | } |
| 1090 | s->filetype = filetype; | ||
| 1091 | } | 1087 | } |
| 1092 | return tcc_add_file_internal(s, filename, flags); | 1088 | return tcc_add_file_internal(s, filename, filetype | AFF_PRINT_ERROR); |
| 1093 | } | 1089 | } |
| 1094 | 1090 | ||
| 1095 | LIBTCCAPI int tcc_add_library_path(TCCState *s, const char *pathname) | 1091 | LIBTCCAPI int tcc_add_library_path(TCCState *s, const char *pathname) |
| @@ -1141,9 +1137,10 @@ LIBTCCAPI int tcc_add_library(TCCState *s, const char *libraryname) · 45 unmodified lines | |||
| 1141 | const char *libs[] = { "%s/lib%s.so", "%s/lib%s.a", NULL }; | 1137 | const char *libs[] = { "%s/lib%s.so", "%s/lib%s.a", NULL }; |
| 1142 | const char **pp = s->static_link ? libs + 1 : libs; | 1138 | const char **pp = s->static_link ? libs + 1 : libs; |
| 1143 | #endif | 1139 | #endif |
| 1140 | int flags = s->filetype & AFF_WHOLE_ARCHIVE; | ||
| 1144 | while (*pp) { | 1141 | while (*pp) { |
| 1145 | if (0 == tcc_add_library_internal(s, *pp, | 1142 | if (0 == tcc_add_library_internal(s, *pp, |
| 1146 | libraryname, 0, s->library_paths, s->nb_library_paths)) | 1143 | libraryname, flags, s->library_paths, s->nb_library_paths)) |
| 1147 | return 0; | 1144 | return 0; |
| 1148 | ++pp; | 1145 | ++pp; |
| 1149 | } | 1146 | } |
| @@ -1409,7 +1406,10 @@ static int tcc_set_linker(TCCState *s, const char *option) · 259 unmodified lines | |||
| 1409 | goto err; | 1406 | goto err; |
| 1410 | #endif | 1407 | #endif |
| 1411 | } else if (ret = link_option(option, "?whole-archive", &p), ret) { | 1408 | } else if (ret = link_option(option, "?whole-archive", &p), ret) { |
| 1412 | s->alacarte_link = ret < 0; | 1409 | if (ret > 0) |
| 1410 | s->filetype |= AFF_WHOLE_ARCHIVE; | ||
| 1411 | else | ||
| 1412 | s->filetype &= ~AFF_WHOLE_ARCHIVE; | ||
| 1413 | } else if (p) { | 1413 | } else if (p) { |
| 1414 | return 0; | 1414 | return 0; |
| 1415 | } else { | 1415 | } else { |
| @@ -1595,7 +1595,6 @@ static void args_parser_add_file(TCCState *s, const char* filename, int filetype · 179 unmodified lines | |||
| 1595 | { | 1595 | { |
| 1596 | struct filespec *f = tcc_malloc(sizeof *f + strlen(filename)); | 1596 | struct filespec *f = tcc_malloc(sizeof *f + strlen(filename)); |
| 1597 | f->type = filetype; | 1597 | f->type = filetype; |
| 1598 | f->alacarte = s->alacarte_link; | ||
| 1599 | strcpy(f->name, filename); | 1598 | strcpy(f->name, filename); |
| 1600 | dynarray_add(&s->files, &s->nb_files, f); | 1599 | dynarray_add(&s->files, &s->nb_files, f); |
| 1601 | } | 1600 | } |
| @@ -1742,7 +1741,7 @@ reparse: · 140 unmodified lines | |||
| 1742 | tcc_set_lib_path(s, optarg); | 1741 | tcc_set_lib_path(s, optarg); |
| 1743 | break; | 1742 | break; |
| 1744 | case TCC_OPTION_l: | 1743 | case TCC_OPTION_l: |
| 1745 | args_parser_add_file(s, optarg, AFF_TYPE_LIB); | 1744 | args_parser_add_file(s, optarg, AFF_TYPE_LIB | (s->filetype & ~AFF_TYPE_MASK)); |
| 1746 | s->nb_libraries++; | 1745 | s->nb_libraries++; |
| 1747 | break; | 1746 | break; |
| 1748 | case TCC_OPTION_pthread: | 1747 | case TCC_OPTION_pthread: |
| @@ -1896,14 +1895,18 @@ reparse: · 147 unmodified lines | |||
| 1896 | exit(0); | 1895 | exit(0); |
| 1897 | break; | 1896 | break; |
| 1898 | case TCC_OPTION_x: | 1897 | case TCC_OPTION_x: |
| 1898 | x = 0; | ||
| 1899 | if (*optarg == 'c') | 1899 | if (*optarg == 'c') |
| 1900 | s->filetype = AFF_TYPE_C; | 1900 | x = AFF_TYPE_C; |
| 1901 | else if (*optarg == 'a') | 1901 | else if (*optarg == 'a') |
| 1902 | s->filetype = AFF_TYPE_ASMPP; | 1902 | x = AFF_TYPE_ASMPP; |
| 1903 | else if (*optarg == 'b') | ||
| 1904 | x = AFF_TYPE_BIN; | ||
| 1903 | else if (*optarg == 'n') | 1905 | else if (*optarg == 'n') |
| 1904 | s->filetype = AFF_TYPE_NONE; | 1906 | x = AFF_TYPE_NONE; |
| 1905 | else | 1907 | else |
| 1906 | tcc_warning("unsupported language '%s'", optarg); | 1908 | tcc_warning("unsupported language '%s'", optarg); |
| 1909 | s->filetype = x | (s->filetype & ~AFF_TYPE_MASK); | ||
| 1907 | break; | 1910 | break; |
| 1908 | case TCC_OPTION_O: | 1911 | case TCC_OPTION_O: |
| 1909 | last_o = atoi(optarg); | 1912 | last_o = atoi(optarg); |
| @@ -62,7 +62,7 @@ static const char help[] = · 61 unmodified lines | |||
| 62 | " -bt N show N callers in stack traces\n" | 62 | " -bt N show N callers in stack traces\n" |
| 63 | #endif | 63 | #endif |
| 64 | "Misc. options:\n" | 64 | "Misc. options:\n" |
| 65 | " -x[c|a|n] specify type of the next infile\n" | 65 | " -x[c|a|b|n] specify type of the next infile (C,ASM,BIN,NONE)\n" |
| 66 | " -nostdinc do not use standard system include paths\n" | 66 | " -nostdinc do not use standard system include paths\n" |
| 67 | " -nostdlib do not link with standard crt and libraries\n" | 67 | " -nostdlib do not link with standard crt and libraries\n" |
| 68 | " -Bdir set tcc's private include/library dir\n" | 68 | " -Bdir set tcc's private include/library dir\n" |
| @@ -322,8 +322,7 @@ redo: · 253 unmodified lines | |||
| 322 | for (first_file = NULL, ret = 0;;) { | 322 | for (first_file = NULL, ret = 0;;) { |
| 323 | struct filespec *f = s->files[s->nb_files - n]; | 323 | struct filespec *f = s->files[s->nb_files - n]; |
| 324 | s->filetype = f->type; | 324 | s->filetype = f->type; |
| 325 | s->alacarte_link = f->alacarte; | 325 | if (f->type & AFF_TYPE_LIB) { |
| 326 | if (f->type == AFF_TYPE_LIB) { | ||
| 327 | if (tcc_add_library_err(s, f->name) < 0) | 326 | if (tcc_add_library_err(s, f->name) < 0) |
| 328 | ret = 1; | 327 | ret = 1; |
| 329 | } else { | 328 | } else { |
| @@ -334,8 +333,6 @@ redo: · 4 unmodified lines | |||
| 334 | if (tcc_add_file(s, f->name) < 0) | 333 | if (tcc_add_file(s, f->name) < 0) |
| 335 | ret = 1; | 334 | ret = 1; |
| 336 | } | 335 | } |
| 337 | s->filetype = 0; | ||
| 338 | s->alacarte_link = 1; | ||
| 339 | if (--n == 0 || ret | 336 | if (--n == 0 || ret |
| 340 | || (s->output_type == TCC_OUTPUT_OBJ && !s->option_r)) | 337 | || (s->output_type == TCC_OUTPUT_OBJ && !s->option_r)) |
| 341 | break; | 338 | break; |
| @@ -638,7 +638,6 @@ struct sym_attr { · 637 unmodified lines | |||
| 638 | }; | 638 | }; |
| 639 | 639 | ||
| 640 | struct TCCState { | 640 | struct TCCState { |
| 641 | |||
| 642 | int verbose; /* if true, display some information during compilation */ | 641 | int verbose; /* if true, display some information during compilation */ |
| 643 | int nostdinc; /* if true, no standard headers are added */ | 642 | int nostdinc; /* if true, no standard headers are added */ |
| 644 | int nostdlib; /* if true, no standard libraries are added */ | 643 | int nostdlib; /* if true, no standard libraries are added */ |
| @@ -646,7 +645,7 @@ struct TCCState { · 1 unmodified line | |||
| 646 | int static_link; /* if true, static linking is performed */ | 645 | int static_link; /* if true, static linking is performed */ |
| 647 | int rdynamic; /* if true, all symbols are exported */ | 646 | int rdynamic; /* if true, all symbols are exported */ |
| 648 | int symbolic; /* if true, resolve symbols in the current module first */ | 647 | int symbolic; /* if true, resolve symbols in the current module first */ |
| 649 | int alacarte_link; /* if true, only link in referenced objects from archive */ | 648 | int filetype; /* file type for compilation (NONE,C,ASM) */ |
| 650 | 649 | ||
| 651 | char *tcc_lib_path; /* CONFIG_TCCDIR or -B option */ | 650 | char *tcc_lib_path; /* CONFIG_TCCDIR or -B option */ |
| 652 | char *soname; /* as specified on the command line (-soname) */ | 651 | char *soname; /* as specified on the command line (-soname) */ |
| @@ -811,7 +810,6 @@ struct TCCState { · 158 unmodified lines | |||
| 811 | struct filespec **files; /* files seen on command line */ | 810 | struct filespec **files; /* files seen on command line */ |
| 812 | int nb_files; /* number thereof */ | 811 | int nb_files; /* number thereof */ |
| 813 | int nb_libraries; /* number of libs thereof */ | 812 | int nb_libraries; /* number of libs thereof */ |
| 814 | int filetype; | ||
| 815 | char *outfile; /* output filename */ | 813 | char *outfile; /* output filename */ |
| 816 | int option_r; /* option -r */ | 814 | int option_r; /* option -r */ |
| 817 | int do_bench; /* option -bench */ | 815 | int do_bench; /* option -bench */ |
| @@ -824,7 +822,6 @@ struct TCCState { · 6 unmodified lines | |||
| 824 | 822 | ||
| 825 | struct filespec { | 823 | struct filespec { |
| 826 | char type; | 824 | char type; |
| 827 | char alacarte; | ||
| 828 | char name[1]; | 825 | char name[1]; |
| 829 | }; | 826 | }; |
| 830 | 827 | ||
| @@ -1150,12 +1147,14 @@ ST_FUNC int tcc_add_file_internal(TCCState *s1, const char *filename, int flags) · 319 unmodified lines | |||
| 1150 | #define AFF_PRINT_ERROR 0x10 /* print error if file not found */ | 1147 | #define AFF_PRINT_ERROR 0x10 /* print error if file not found */ |
| 1151 | #define AFF_REFERENCED_DLL 0x20 /* load a referenced dll from another dll */ | 1148 | #define AFF_REFERENCED_DLL 0x20 /* load a referenced dll from another dll */ |
| 1152 | #define AFF_TYPE_BIN 0x40 /* file to add is binary */ | 1149 | #define AFF_TYPE_BIN 0x40 /* file to add is binary */ |
| 1150 | #define AFF_WHOLE_ARCHIVE 0x80 /* load all objects from archive */ | ||
| 1153 | /* s->filetype: */ | 1151 | /* s->filetype: */ |
| 1154 | #define AFF_TYPE_NONE 0 | 1152 | #define AFF_TYPE_NONE 0 |
| 1155 | #define AFF_TYPE_C 1 | 1153 | #define AFF_TYPE_C 1 |
| 1156 | #define AFF_TYPE_ASM 2 | 1154 | #define AFF_TYPE_ASM 2 |
| 1157 | #define AFF_TYPE_ASMPP 3 | 1155 | #define AFF_TYPE_ASMPP 4 |
| 1158 | #define AFF_TYPE_LIB 4 | 1156 | #define AFF_TYPE_LIB 8 |
| 1157 | #define AFF_TYPE_MASK (15 | AFF_TYPE_BIN) | ||
| 1159 | /* values from tcc_object_type(...) */ | 1158 | /* values from tcc_object_type(...) */ |
| 1160 | #define AFF_BINTYPE_REL 1 | 1159 | #define AFF_BINTYPE_REL 1 |
| 1161 | #define AFF_BINTYPE_DYN 2 | 1160 | #define AFF_BINTYPE_DYN 2 |
| @@ -1423,7 +1422,7 @@ ST_FUNC void relocate_section(TCCState *s1, Section *s); · 261 unmodified lines | |||
| 1423 | 1422 | ||
| 1424 | ST_FUNC int tcc_object_type(int fd, ElfW(Ehdr) *h); | 1423 | ST_FUNC int tcc_object_type(int fd, ElfW(Ehdr) *h); |
| 1425 | ST_FUNC int tcc_load_object_file(TCCState *s1, int fd, unsigned long file_offset); | 1424 | ST_FUNC int tcc_load_object_file(TCCState *s1, int fd, unsigned long file_offset); |
| 1426 | ST_FUNC int tcc_load_archive(TCCState *s1, int fd); | 1425 | ST_FUNC int tcc_load_archive(TCCState *s1, int fd, int alacarte); |
| 1427 | ST_FUNC void tcc_add_bcheck(TCCState *s1); | 1426 | ST_FUNC void tcc_add_bcheck(TCCState *s1); |
| 1428 | ST_FUNC void tcc_add_runtime(TCCState *s1); | 1427 | ST_FUNC void tcc_add_runtime(TCCState *s1); |
| 1429 | 1428 | ||
| @@ -1146,7 +1146,6 @@ static void add_init_array_defines(TCCState *s1, const char *section_name) · 1145 unmodified lines | |||
| 1146 | ELFW(ST_INFO)(STB_GLOBAL, STT_NOTYPE), 0, | 1146 | ELFW(ST_INFO)(STB_GLOBAL, STT_NOTYPE), 0, |
| 1147 | s->sh_num, sym_end); | 1147 | s->sh_num, sym_end); |
| 1148 | } | 1148 | } |
| 1149 | #endif | ||
| 1150 | 1149 | ||
| 1151 | static int tcc_add_support(TCCState *s1, const char *filename) | 1150 | static int tcc_add_support(TCCState *s1, const char *filename) |
| 1152 | { | 1151 | { |
| @@ -1154,6 +1153,7 @@ static int tcc_add_support(TCCState *s1, const char *filename) · 1 unmodified line | |||
| 1154 | snprintf(buf, sizeof(buf), "%s/%s", s1->tcc_lib_path, filename); | 1153 | snprintf(buf, sizeof(buf), "%s/%s", s1->tcc_lib_path, filename); |
| 1155 | return tcc_add_file(s1, buf); | 1154 | return tcc_add_file(s1, buf); |
| 1156 | } | 1155 | } |
| 1156 | #endif | ||
| 1157 | 1157 | ||
| 1158 | ST_FUNC void tcc_add_bcheck(TCCState *s1) | 1158 | ST_FUNC void tcc_add_bcheck(TCCState *s1) |
| 1159 | { | 1159 | { |
| @@ -1189,8 +1189,10 @@ ST_FUNC void tcc_add_bcheck(TCCState *s1) · 29 unmodified lines | |||
| 1189 | /* add tcc runtime libraries */ | 1189 | /* add tcc runtime libraries */ |
| 1190 | ST_FUNC void tcc_add_runtime(TCCState *s1) | 1190 | ST_FUNC void tcc_add_runtime(TCCState *s1) |
| 1191 | { | 1191 | { |
| 1192 | s1->filetype = 0; | ||
| 1192 | tcc_add_bcheck(s1); | 1193 | tcc_add_bcheck(s1); |
| 1193 | tcc_add_pragma_libs(s1); | 1194 | tcc_add_pragma_libs(s1); |
| 1195 | #ifndef TCC_TARGET_PE | ||
| 1194 | /* add libc */ | 1196 | /* add libc */ |
| 1195 | if (!s1->nostdlib) { | 1197 | if (!s1->nostdlib) { |
| 1196 | tcc_add_library_err(s1, "c"); | 1198 | tcc_add_library_err(s1, "c"); |
| @@ -1207,6 +1209,7 @@ ST_FUNC void tcc_add_runtime(TCCState *s1) · 10 unmodified lines | |||
| 1207 | if (s1->output_type != TCC_OUTPUT_MEMORY) | 1209 | if (s1->output_type != TCC_OUTPUT_MEMORY) |
| 1208 | tcc_add_crt(s1, "crtn.o"); | 1210 | tcc_add_crt(s1, "crtn.o"); |
| 1209 | } | 1211 | } |
| 1212 | #endif | ||
| 1210 | } | 1213 | } |
| 1211 | 1214 | ||
| 1212 | /* add various standard linker symbols (must be done after the | 1215 | /* add various standard linker symbols (must be done after the |
| @@ -2628,7 +2631,7 @@ static int tcc_load_alacarte(TCCState *s1, int fd, int size, int entrysize) · 1415 unmodified lines | |||
| 2628 | } | 2631 | } |
| 2629 | 2632 | ||
| 2630 | /* load a '.a' file */ | 2633 | /* load a '.a' file */ |
| 2631 | ST_FUNC int tcc_load_archive(TCCState *s1, int fd) | 2634 | ST_FUNC int tcc_load_archive(TCCState *s1, int fd, int alacarte) |
| 2632 | { | 2635 | { |
| 2633 | ArchiveHeader hdr; | 2636 | ArchiveHeader hdr; |
| 2634 | char ar_size[11]; | 2637 | char ar_size[11]; |
| @@ -2662,10 +2665,10 @@ ST_FUNC int tcc_load_archive(TCCState *s1, int fd) · 27 unmodified lines | |||
| 2662 | size = (size + 1) & ~1; | 2665 | size = (size + 1) & ~1; |
| 2663 | if (!strcmp(ar_name, "/")) { | 2666 | if (!strcmp(ar_name, "/")) { |
| 2664 | /* coff symbol table : we handle it */ | 2667 | /* coff symbol table : we handle it */ |
| 2665 | if(s1->alacarte_link) | 2668 | if (alacarte) |
| 2666 | return tcc_load_alacarte(s1, fd, size, 4); | 2669 | return tcc_load_alacarte(s1, fd, size, 4); |
| 2667 | } else if (!strcmp(ar_name, "/SYM64/")) { | 2670 | } else if (!strcmp(ar_name, "/SYM64/")) { |
| 2668 | if(s1->alacarte_link) | 2671 | if (alacarte) |
| 2669 | return tcc_load_alacarte(s1, fd, size, 8); | 2672 | return tcc_load_alacarte(s1, fd, size, 8); |
| 2670 | } else { | 2673 | } else { |
| 2671 | ElfW(Ehdr) ehdr; | 2674 | ElfW(Ehdr) ehdr; |
| @@ -1866,8 +1866,6 @@ static void pe_add_runtime(TCCState *s1, struct pe_info *pe) · 1865 unmodified lines | |||
| 1866 | ELFW(ST_INFO)(STB_GLOBAL, STT_NOTYPE), 0, | 1866 | ELFW(ST_INFO)(STB_GLOBAL, STT_NOTYPE), 0, |
| 1867 | SHN_UNDEF, start_symbol); | 1867 | SHN_UNDEF, start_symbol); |
| 1868 | 1868 | ||
| 1869 | tcc_add_pragma_libs(s1); | ||
| 1870 | |||
| 1871 | if (0 == s1->nostdlib) { | 1869 | if (0 == s1->nostdlib) { |
| 1872 | static const char *libs[] = { | 1870 | static const char *libs[] = { |
| 1873 | TCC_LIBTCC1, "msvcrt", "kernel32", "", "user32", "gdi32", NULL | 1871 | TCC_LIBTCC1, "msvcrt", "kernel32", "", "user32", "gdi32", NULL |
| @@ -1948,7 +1946,7 @@ ST_FUNC int pe_output_file(TCCState *s1, const char *filename) · 74 unmodified lines | |||
| 1948 | pe.filename = filename; | 1946 | pe.filename = filename; |
| 1949 | pe.s1 = s1; | 1947 | pe.s1 = s1; |
| 1950 | 1948 | ||
| 1951 | tcc_add_bcheck(s1); | 1949 | tcc_add_runtime(s1); |
| 1952 | pe_add_runtime(s1, &pe); | 1950 | pe_add_runtime(s1, &pe); |
| 1953 | resolve_common_syms(s1); | 1951 | resolve_common_syms(s1); |
| 1954 | pe_set_options(s1, &pe); | 1952 | pe_set_options(s1, &pe); |