| @@ -515,7 +515,7 @@ ST_FUNC void put_extern_sym2(Sym *sym, Section *section, · 514 unmodified lines |
| 515 | } | 515 | } |
| 516 | #else | 516 | #else |
| 517 | if (! (sym->type.t & VT_STATIC)) | 517 | if (! (sym->type.t & VT_STATIC)) |
| 518 | other = (sym->type.t & VT_VIS_MASK) >> VT_VIS_SHIFT; | 518 | other = (sym->type.t & VT_VIS_MASK) >> VT_VIS_SHIFT; |
| 519 | #endif | 519 | #endif |
| 520 | if (tcc_state->leading_underscore && can_add_underscore) { | 520 | if (tcc_state->leading_underscore && can_add_underscore) { |
| 521 | buf1[0] = '_'; | 521 | buf1[0] = '_'; |
| @@ -829,13 +829,31 @@ static int tcc_compile(TCCState *s1) · 307 unmodified lines |
| 829 | | 829 | |
| 830 | LIBTCCAPI int tcc_compile_string(TCCState *s, const char *str) | 830 | LIBTCCAPI int tcc_compile_string(TCCState *s, const char *str) |
| 831 | { | 831 | { |
| | 832 | int i; |
| 832 | int len, ret; | 833 | int len, ret; |
| 833 | len = strlen(str); | 834 | len = strlen(str); |
| 834 | | 835 | |
| 835 | tcc_open_bf(s, "<string>", len); | 836 | tcc_open_bf(s, "<string>", len); |
| 836 | memcpy(file->buffer, str, len); | 837 | memcpy(file->buffer, str, len); |
| | 838 | |
| | 839 | len = s->nb_files; |
| 837 | ret = tcc_compile(s); | 840 | ret = tcc_compile(s); |
| 838 | tcc_close(); | 841 | tcc_close(); |
| | 842 | |
| | 843 | /* habdle #pragma comment(lib,) */ |
| | 844 | for(i = len; i < s->nb_files; i++) { |
| | 845 | /* int filetype = *(unsigned char *)s->files[i]; */ |
| | 846 | const char *filename = s->files[i] + 1; |
| | 847 | if (filename[0] == '-' && filename[1] == 'l') { |
| | 848 | if (tcc_add_library(s, filename + 2) < 0) { |
| | 849 | tcc_warning("cannot find '%s'", filename+2); |
| | 850 | ret++; |
| | 851 | } |
| | 852 | } |
| | 853 | tcc_free(s->files[i]); |
| | 854 | } |
| | 855 | s->nb_files = len; |
| | 856 | |
| 839 | return ret; | 857 | return ret; |
| 840 | } | 858 | } |
| 841 | | 859 | |
| @@ -1339,7 +1357,7 @@ LIBTCCAPI int tcc_set_output_type(TCCState *s, int output_type) · 497 unmodified lines |
| 1339 | { | 1357 | { |
| 1340 | s->output_type = output_type; | 1358 | s->output_type = output_type; |
| 1341 | if (output_type == TCC_OUTPUT_PREPROCESS) | 1359 | if (output_type == TCC_OUTPUT_PREPROCESS) |
| 1342 | print_defines(); | 1360 | print_defines(); |
| 1343 | | 1361 | |
| 1344 | if (!s->nostdinc) { | 1362 | if (!s->nostdinc) { |
| 1345 | /* default include paths */ | 1363 | /* default include paths */ |
| @@ -1899,16 +1917,16 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv) · 553 unmodified lines |
| 1899 | s->do_debug = 1; | 1917 | s->do_debug = 1; |
| 1900 | break; | 1918 | break; |
| 1901 | case TCC_OPTION_c: | 1919 | case TCC_OPTION_c: |
| 1902 | if (s->output_type) | 1920 | if (s->output_type) |
| 1903 | tcc_warning("-c: some compiler action already specified (%d)", s->output_type); | 1921 | tcc_warning("-c: some compiler action already specified (%d)", s->output_type); |
| 1904 | s->output_type = TCC_OUTPUT_OBJ; | 1922 | s->output_type = TCC_OUTPUT_OBJ; |
| 1905 | break; | 1923 | break; |
| 1906 | case TCC_OPTION_d: | 1924 | case TCC_OPTION_d: |
| 1907 | if (*optarg != 'D') { | 1925 | if (*optarg != 'D') { |
| 1908 | if (s->warn_unsupported) | 1926 | if (s->warn_unsupported) |
| 1909 | goto unsupported_option; | 1927 | goto unsupported_option; |
| 1910 | tcc_error("invalid option -- '%s'", r); | 1928 | tcc_error("invalid option -- '%s'", r); |
| 1911 | } | 1929 | } |
| 1912 | s->dflag = 1; | 1930 | s->dflag = 1; |
| 1913 | break; | 1931 | break; |
| 1914 | #ifdef TCC_TARGET_ARM | 1932 | #ifdef TCC_TARGET_ARM |
| @@ -1927,11 +1945,11 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv) · 12 unmodified lines |
| 1927 | s->static_link = 1; | 1945 | s->static_link = 1; |
| 1928 | break; | 1946 | break; |
| 1929 | case TCC_OPTION_std: | 1947 | case TCC_OPTION_std: |
| 1930 | /* silently ignore, a current purpose: | 1948 | /* silently ignore, a current purpose: |
| 1931 | allow to use a tcc as a reference compiler for "make test" */ | 1949 | allow to use a tcc as a reference compiler for "make test" */ |
| 1932 | break; | 1950 | break; |
| 1933 | case TCC_OPTION_shared: | 1951 | case TCC_OPTION_shared: |
| 1934 | if (s->output_type) | 1952 | if (s->output_type) |
| 1935 | tcc_warning("-shared: some compiler action already specified (%d)", s->output_type); | 1953 | tcc_warning("-shared: some compiler action already specified (%d)", s->output_type); |
| 1936 | s->output_type = TCC_OUTPUT_DLL; | 1954 | s->output_type = TCC_OUTPUT_DLL; |
| 1937 | break; | 1955 | break; |
| @@ -1946,7 +1964,7 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv) · 8 unmodified lines |
| 1946 | break; | 1964 | break; |
| 1947 | case TCC_OPTION_r: | 1965 | case TCC_OPTION_r: |
| 1948 | /* generate a .o merging several output files */ | 1966 | /* generate a .o merging several output files */ |
| 1949 | if (s->output_type) | 1967 | if (s->output_type) |
| 1950 | tcc_warning("-r: some compiler action already specified (%d)", s->output_type); | 1968 | tcc_warning("-r: some compiler action already specified (%d)", s->output_type); |
| 1951 | s->option_r = 1; | 1969 | s->option_r = 1; |
| 1952 | s->output_type = TCC_OUTPUT_OBJ; | 1970 | s->output_type = TCC_OUTPUT_OBJ; |
| @@ -1964,7 +1982,7 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv) · 11 unmodified lines |
| 1964 | s->print_search_dirs = 1; | 1982 | s->print_search_dirs = 1; |
| 1965 | break; | 1983 | break; |
| 1966 | case TCC_OPTION_run: | 1984 | case TCC_OPTION_run: |
| 1967 | if (s->output_type) | 1985 | if (s->output_type) |
| 1968 | tcc_warning("-run: some compiler action already specified (%d)", s->output_type); | 1986 | tcc_warning("-run: some compiler action already specified (%d)", s->output_type); |
| 1969 | s->output_type = TCC_OUTPUT_MEMORY; | 1987 | s->output_type = TCC_OUTPUT_MEMORY; |
| 1970 | tcc_set_options(s, optarg); | 1988 | tcc_set_options(s, optarg); |
| @@ -1995,7 +2013,7 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv) · 24 unmodified lines |
| 1995 | cstr_ccat(&linker_arg, '\0'); | 2013 | cstr_ccat(&linker_arg, '\0'); |
| 1996 | break; | 2014 | break; |
| 1997 | case TCC_OPTION_E: | 2015 | case TCC_OPTION_E: |
| 1998 | if (s->output_type) | 2016 | if (s->output_type) |
| 1999 | tcc_warning("-E: some compiler action already specified (%d)", s->output_type); | 2017 | tcc_warning("-E: some compiler action already specified (%d)", s->output_type); |
| 2000 | s->output_type = TCC_OUTPUT_PREPROCESS; | 2018 | s->output_type = TCC_OUTPUT_PREPROCESS; |
| 2001 | break; | 2019 | break; |