Forgot about it. It allows to compile several sources (and other .o's) to one single .o file; tcc -r -o all.o f1.c f2.c f3.S o4.o ... Also: - option -fold-struct-init-code removed, no effect anymore - (tcc_)set_environment() moved to tcc.c - win32/lib/(win)crt1 minor fix & add dependency - debug line output for asm (tcc -c -g xxx.S) enabled - configure/Makefiles: x86-64 -> x86_64 changes - README: cleanup
Unified · Split
| @@ -16,14 +16,14 @@ Platforms: · 15 unmodified lines | |||
| 16 | - vastly improved support for ARM hard float calling convention | 16 | - vastly improved support for ARM hard float calling convention |
| 17 | (Thomas Preud'homme, Daniel Glöckner) | 17 | (Thomas Preud'homme, Daniel Glöckner) |
| 18 | - provide a runtime library for ARM (Thomas Preud'homme) | 18 | - provide a runtime library for ARM (Thomas Preud'homme) |
| 19 | - many x86-64 ABI fixes incl. XMM register passing and tests (James Lyon) | 19 | - many x86_64 ABI fixes incl. XMM register passing and tests (James Lyon) |
| 20 | - ABI tests with native compiler using libtcc (James Lyon) | 20 | - ABI tests with native compiler using libtcc (James Lyon) |
| 21 | - UNICODE startup code supports wmain and wWinMain (YX Hao) | 21 | - UNICODE startup code supports wmain and wWinMain (YX Hao) |
| 22 | 22 | ||
| 23 | Features: | 23 | Features: |
| 24 | - VLA (variable length array) improved (James Lyon, Pip Cet) | 24 | - VLA (variable length array) improved (James Lyon, Pip Cet) |
| 25 | - import functions by ordinal in .def files on windows (YX Hao) | 25 | - import functions by ordinal in .def files on windows (YX Hao) |
| 26 | - x86/x86-64 assembler much improved (Michael Matz) | 26 | - x86/x86_64 assembler much improved (Michael Matz) |
| 27 | - simple dead code suppression (Edmund Grimley Evans, Michael Matz, grischka) | 27 | - simple dead code suppression (Edmund Grimley Evans, Michael Matz, grischka) |
| 28 | - implement round/fmin/fmax etc. math on windows (Avi Halachmi) | 28 | - implement round/fmin/fmax etc. math on windows (Avi Halachmi) |
| 29 | - #pragma once support (Sergey Korshunoff, Vlad Vissoultchev, ...) | 29 | - #pragma once support (Sergey Korshunoff, Vlad Vissoultchev, ...) |
| @@ -56,7 +56,7 @@ LDFLAGS_P = $(LDFLAGS) · 55 unmodified lines | |||
| 56 | 56 | ||
| 57 | CONFIG_$(ARCH) = yes | 57 | CONFIG_$(ARCH) = yes |
| 58 | NATIVE_DEFINES_$(CONFIG_i386) += -DTCC_TARGET_I386 | 58 | NATIVE_DEFINES_$(CONFIG_i386) += -DTCC_TARGET_I386 |
| 59 | NATIVE_DEFINES_$(CONFIG_x86-64) += -DTCC_TARGET_X86_64 | 59 | NATIVE_DEFINES_$(CONFIG_x86_64) += -DTCC_TARGET_X86_64 |
| 60 | NATIVE_DEFINES_$(CONFIG_WIN32) += -DTCC_TARGET_PE | 60 | NATIVE_DEFINES_$(CONFIG_WIN32) += -DTCC_TARGET_PE |
| 61 | NATIVE_DEFINES_$(CONFIG_uClibc) += -DTCC_UCLIBC | 61 | NATIVE_DEFINES_$(CONFIG_uClibc) += -DTCC_UCLIBC |
| 62 | NATIVE_DEFINES_$(CONFIG_arm) += -DTCC_TARGET_ARM | 62 | NATIVE_DEFINES_$(CONFIG_arm) += -DTCC_TARGET_ARM |
| @@ -95,7 +95,7 @@ ARM64_FILES = $(CORE_FILES) arm64-gen.c arm64-link.c · 32 unmodified lines | |||
| 95 | C67_FILES = $(CORE_FILES) c67-gen.c c67-link.c tcccoff.c | 95 | C67_FILES = $(CORE_FILES) c67-gen.c c67-link.c tcccoff.c |
| 96 | 96 | ||
| 97 | ifdef CONFIG_WIN32 | 97 | ifdef CONFIG_WIN32 |
| 98 | ifeq ($(ARCH),x86-64) | 98 | ifeq ($(ARCH),x86_64) |
| 99 | NATIVE_FILES=$(WIN64_FILES) | 99 | NATIVE_FILES=$(WIN64_FILES) |
| 100 | PROGS_CROSS=$(WIN32_CROSS) $(X64_CROSS) $(ARM_CROSS) $(ARM64_CROSS) $(C67_CROSS) $(WINCE_CROSS) | 100 | PROGS_CROSS=$(WIN32_CROSS) $(X64_CROSS) $(ARM_CROSS) $(ARM64_CROSS) $(C67_CROSS) $(WINCE_CROSS) |
| 101 | LIBTCC1_CROSS=lib/i386-win32/libtcc1.a | 101 | LIBTCC1_CROSS=lib/i386-win32/libtcc1.a |
| @@ -110,7 +110,7 @@ NATIVE_FILES=$(I386_FILES) · 8 unmodified lines | |||
| 110 | PROGS_CROSS=$(X64_CROSS) $(WIN32_CROSS) $(WIN64_CROSS) $(ARM_CROSS) $(ARM64_CROSS) $(C67_CROSS) $(WINCE_CROSS) | 110 | PROGS_CROSS=$(X64_CROSS) $(WIN32_CROSS) $(WIN64_CROSS) $(ARM_CROSS) $(ARM64_CROSS) $(C67_CROSS) $(WINCE_CROSS) |
| 111 | LIBTCC1_CROSS=lib/i386-win32/libtcc1.a lib/x86_64-win32/libtcc1.a | 111 | LIBTCC1_CROSS=lib/i386-win32/libtcc1.a lib/x86_64-win32/libtcc1.a |
| 112 | 112 | ||
| 113 | else ifeq ($(ARCH),x86-64) | 113 | else ifeq ($(ARCH),x86_64) |
| 114 | NATIVE_FILES=$(X86_64_FILES) | 114 | NATIVE_FILES=$(X86_64_FILES) |
| 115 | PROGS_CROSS=$(I386_CROSS) $(WIN32_CROSS) $(WIN64_CROSS) $(ARM_CROSS) $(ARM64_CROSS) $(C67_CROSS) $(WINCE_CROSS) | 115 | PROGS_CROSS=$(I386_CROSS) $(WIN32_CROSS) $(WIN64_CROSS) $(ARM_CROSS) $(ARM64_CROSS) $(C67_CROSS) $(WINCE_CROSS) |
| 116 | LIBTCC1_CROSS=lib/i386-win32/libtcc1.a lib/x86_64-win32/libtcc1.a | 116 | LIBTCC1_CROSS=lib/i386-win32/libtcc1.a lib/x86_64-win32/libtcc1.a |
| @@ -28,28 +28,19 @@ Features: · 27 unmodified lines | |||
| 28 | Documentation: | 28 | Documentation: |
| 29 | ------------- | 29 | ------------- |
| 30 | 30 | ||
| 31 | 1) Installation on a i386/x86_64/arm Linux/OSX/FreeBSD host (for Windows read tcc-win32.txt) | 31 | 1) Installation on a i386/x86_64/arm Linux/OSX/FreeBSD host |
| 32 | |||
| 33 | Note: For OSX and FreeBSD, gmake should be used instead of make. | ||
| 34 | 32 | ||
| 35 | ./configure | 33 | ./configure |
| 36 | make | 34 | make |
| 37 | make test | 35 | make test |
| 38 | make install | 36 | make install |
| 39 | 37 | ||
| 40 | Alternatively, out-of-tree builds are supported: you may use different | 38 | Notes: For OSX and FreeBSD, gmake should be used instead of make. |
| 41 | directories to hold build objects, kept separate from your source tree: | 39 | For Windows read tcc-win32.txt. |
| 42 | |||
| 43 | mkdir _build | ||
| 44 | cd _build | ||
| 45 | ../configure | ||
| 46 | make | ||
| 47 | make test | ||
| 48 | make install | ||
| 49 | 40 | ||
| 50 | Texi2html must be installed to compile the doc. | 41 | makeinfo must be installed to compile the doc. By default, tcc is |
| 51 | By default, tcc is installed in /usr/local/bin. | 42 | installed in /usr/local/bin. ./configure --help shows configuration |
| 52 | ./configure --help shows configuration options. | 43 | options. |
| 53 | 44 | ||
| 54 | 45 | ||
| 55 | 2) Introduction | 46 | 2) Introduction |
| @@ -163,8 +163,8 @@ case "$cpu" in · 162 unmodified lines | |||
| 163 | x86|i386|i486|i586|i686|i86pc|BePC|i686-AT386) | 163 | x86|i386|i486|i586|i686|i86pc|BePC|i686-AT386) |
| 164 | cpu="x86" | 164 | cpu="x86" |
| 165 | ;; | 165 | ;; |
| 166 | x86_64|amd64) | 166 | x86_64|amd64|x86-64) |
| 167 | cpu="x86-64" | 167 | cpu="x86_64" |
| 168 | ;; | 168 | ;; |
| 169 | arm*) | 169 | arm*) |
| 170 | case "$cpu" in | 170 | case "$cpu" in |
| @@ -332,7 +332,7 @@ if test -z "$cross_prefix" ; then · 161 unmodified lines | |||
| 332 | fi | 332 | fi |
| 333 | 333 | ||
| 334 | if test -z "$triplet"; then | 334 | if test -z "$triplet"; then |
| 335 | if test $cpu = "x86-64" -o $cpu = "aarch64" ; then | 335 | if test $cpu = "x86_64" -o $cpu = "aarch64" ; then |
| 336 | if test -f "/usr/lib64/crti.o" ; then | 336 | if test -f "/usr/lib64/crti.o" ; then |
| 337 | tcc_lddir="lib64" | 337 | tcc_lddir="lib64" |
| 338 | fi | 338 | fi |
| @@ -453,8 +453,8 @@ echo "#define GCC_MINOR $gcc_minor" >> $TMPH · 114 unmodified lines | |||
| 453 | 453 | ||
| 454 | if test "$cpu" = "x86" ; then | 454 | if test "$cpu" = "x86" ; then |
| 455 | echo "ARCH=i386" >> config.mak | 455 | echo "ARCH=i386" >> config.mak |
| 456 | elif test "$cpu" = "x86-64" ; then | 456 | elif test "$cpu" = "x86_64" ; then |
| 457 | echo "ARCH=x86-64" >> config.mak | 457 | echo "ARCH=x86_64" >> config.mak |
| 458 | elif test "$cpu" = "armv4l" ; then | 458 | elif test "$cpu" = "armv4l" ; then |
| 459 | echo "ARCH=arm" >> config.mak | 459 | echo "ARCH=arm" >> config.mak |
| 460 | echo "#define TCC_ARM_VERSION $cpuver" >> $TMPH | 460 | echo "#define TCC_ARM_VERSION $cpuver" >> $TMPH |
| @@ -9,14 +9,14 @@ VPATH = $(TOPSRC)/lib $(TOPSRC)/win32/lib · 8 unmodified lines | |||
| 9 | ifndef TARGET | 9 | ifndef TARGET |
| 10 | # we're building the native libtcc1.a | 10 | # we're building the native libtcc1.a |
| 11 | ifdef CONFIG_WIN32 | 11 | ifdef CONFIG_WIN32 |
| 12 | ifeq ($(ARCH),x86-64) | 12 | ifeq ($(ARCH),x86_64) |
| 13 | TARGET = x86_64-win32 | 13 | TARGET = x86_64-win32 |
| 14 | else | 14 | else |
| 15 | TARGET = i386-win32 | 15 | TARGET = i386-win32 |
| 16 | endif | 16 | endif |
| 17 | else ifeq ($(ARCH),i386) | 17 | else ifeq ($(ARCH),i386) |
| 18 | TARGET = i386 | 18 | TARGET = i386 |
| 19 | else ifeq ($(ARCH),x86-64) | 19 | else ifeq ($(ARCH),x86_64) |
| 20 | TARGET = x86_64 | 20 | TARGET = x86_64 |
| 21 | else ifeq ($(ARCH),arm) | 21 | else ifeq ($(ARCH),arm) |
| 22 | TARGET = arm | 22 | TARGET = arm |
| @@ -83,6 +83,9 @@ $(DIR)/%.o : %.c · 60 unmodified lines | |||
| 83 | $(DIR)/%.o : %.S | 83 | $(DIR)/%.o : %.S |
| 84 | $(XCC) -c $< -o $@ $(TGT) $(XFLAGS) | 84 | $(XCC) -c $< -o $@ $(TGT) $(XFLAGS) |
| 85 | 85 | ||
| 86 | $(DIR)/crt1w.o : crt1.c | ||
| 87 | $(DIR)/wincrt1w.o : wincrt1.c | ||
| 88 | |||
| 86 | $(OBJ) : $(DIR)/exists | 89 | $(OBJ) : $(DIR)/exists |
| 87 | 90 | ||
| 88 | %/exists : | 91 | %/exists : |
| @@ -1572,7 +1572,6 @@ static const FlagDef options_f[] = { · 1571 unmodified lines | |||
| 1572 | { offsetof(TCCState, nocommon), FD_INVERT, "common" }, | 1572 | { offsetof(TCCState, nocommon), FD_INVERT, "common" }, |
| 1573 | { offsetof(TCCState, leading_underscore), 0, "leading-underscore" }, | 1573 | { offsetof(TCCState, leading_underscore), 0, "leading-underscore" }, |
| 1574 | { offsetof(TCCState, ms_extensions), 0, "ms-extensions" }, | 1574 | { offsetof(TCCState, ms_extensions), 0, "ms-extensions" }, |
| 1575 | { offsetof(TCCState, old_struct_init_code), 0, "old-struct-init-code" }, | ||
| 1576 | { offsetof(TCCState, dollars_in_identifiers), 0, "dollars-in-identifiers" }, | 1575 | { offsetof(TCCState, dollars_in_identifiers), 0, "dollars-in-identifiers" }, |
| 1577 | { 0, 0, NULL } | 1576 | { 0, 0, NULL } |
| 1578 | }; | 1577 | }; |
| @@ -1984,21 +1983,3 @@ PUB_FUNC void tcc_print_stats(TCCState *s, unsigned total_time) · 405 unmodified lines | |||
| 1984 | fprintf(stderr, "* %d bytes memory used\n", mem_max_size); | 1983 | fprintf(stderr, "* %d bytes memory used\n", mem_max_size); |
| 1985 | #endif | 1984 | #endif |
| 1986 | } | 1985 | } |
| 1987 | |||
| 1988 | PUB_FUNC void tcc_set_environment(TCCState *s) | ||
| 1989 | { | ||
| 1990 | char * path; | ||
| 1991 | |||
| 1992 | path = getenv("C_INCLUDE_PATH"); | ||
| 1993 | if(path != NULL) { | ||
| 1994 | tcc_add_include_path(s, path); | ||
| 1995 | } | ||
| 1996 | path = getenv("CPATH"); | ||
| 1997 | if(path != NULL) { | ||
| 1998 | tcc_add_include_path(s, path); | ||
| 1999 | } | ||
| 2000 | path = getenv("LIBRARY_PATH"); | ||
| 2001 | if(path != NULL) { | ||
| 2002 | tcc_add_library_path(s, path); | ||
| 2003 | } | ||
| 2004 | } | ||
| @@ -387,10 +387,10 @@ gcc's algorithm. · 386 unmodified lines | |||
| 387 | Select the float ABI. Possible values: @code{softfp} and @code{hard} | 387 | Select the float ABI. Possible values: @code{softfp} and @code{hard} |
| 388 | 388 | ||
| 389 | @item -mno-sse | 389 | @item -mno-sse |
| 390 | Do not use sse registers on x86-64 | 390 | Do not use sse registers on x86_64 |
| 391 | 391 | ||
| 392 | @item -m32, -m64 | 392 | @item -m32, -m64 |
| 393 | Pass command line to the i386/x86-64 cross compiler. | 393 | Pass command line to the i386/x86_64 cross compiler. |
| 394 | 394 | ||
| 395 | @end table | 395 | @end table |
| 396 | 396 | ||
| @@ -104,9 +104,8 @@ static const char help2[] = · 103 unmodified lines | |||
| 104 | " signed-char default char is signed\n" | 104 | " signed-char default char is signed\n" |
| 105 | " common use common section instead of bss\n" | 105 | " common use common section instead of bss\n" |
| 106 | " leading-underscore decorate extern symbols\n" | 106 | " leading-underscore decorate extern symbols\n" |
| 107 | " ms-extensions allow struct w/o identifier\n" | 107 | " ms-extensions allow anonymous struct in struct\n" |
| 108 | " dollars-in-identifiers allow '$' in C symbols\n" | 108 | " dollars-in-identifiers allow '$' in C symbols\n" |
| 109 | " old-struct-init-code some hack for parsing initializers\n" | ||
| 110 | "-m... target specific options:\n" | 109 | "-m... target specific options:\n" |
| 111 | " ms-bitfields use MSVC bitfield layout\n" | 110 | " ms-bitfields use MSVC bitfield layout\n" |
| 112 | #ifdef TCC_TARGET_ARM | 111 | #ifdef TCC_TARGET_ARM |
| @@ -151,32 +150,18 @@ static const char version[] = · 38 unmodified lines | |||
| 151 | "C67" | 150 | "C67" |
| 152 | #elif defined TCC_TARGET_ARM | 151 | #elif defined TCC_TARGET_ARM |
| 153 | "ARM" | 152 | "ARM" |
| 154 | # ifdef TCC_ARM_HARDFLOAT | ||
| 155 | " Hard Float" | ||
| 156 | # endif | ||
| 157 | #elif defined TCC_TARGET_ARM64 | 153 | #elif defined TCC_TARGET_ARM64 |
| 158 | "AArch64" | 154 | "AArch64" |
| 159 | # ifdef TCC_ARM_HARDFLOAT | 155 | #endif |
| 156 | #ifdef TCC_ARM_HARDFLOAT | ||
| 160 | " Hard Float" | 157 | " Hard Float" |
| 161 | # endif | ||
| 162 | #endif | 158 | #endif |
| 163 | #ifdef TCC_TARGET_PE | 159 | #ifdef TCC_TARGET_PE |
| 164 | " Windows" | 160 | " Windows" |
| 165 | #elif defined(__APPLE__) | ||
| 166 | /* Current Apple OS name as of 2016 */ | ||
| 167 | " macOS" | ||
| 168 | #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) | 161 | #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) |
| 169 | " FreeBSD" | 162 | " FreeBSD" |
| 170 | #elif defined(__DragonFly__) | ||
| 171 | " DragonFly BSD" | ||
| 172 | #elif defined(__NetBSD__) | ||
| 173 | " NetBSD" | ||
| 174 | #elif defined(__OpenBSD__) | ||
| 175 | " OpenBSD" | ||
| 176 | #elif defined(__linux__) | ||
| 177 | " Linux" | ||
| 178 | #else | 163 | #else |
| 179 | " Unidentified system" | 164 | " Linux" |
| 180 | #endif | 165 | #endif |
| 181 | ")\n" | 166 | ")\n" |
| 182 | ; | 167 | ; |
| @@ -201,6 +186,24 @@ static void print_search_dirs(TCCState *s) · 18 unmodified lines | |||
| 201 | #endif | 186 | #endif |
| 202 | } | 187 | } |
| 203 | 188 | ||
| 189 | static void set_environment(TCCState *s) | ||
| 190 | { | ||
| 191 | char * path; | ||
| 192 | |||
| 193 | path = getenv("C_INCLUDE_PATH"); | ||
| 194 | if(path != NULL) { | ||
| 195 | tcc_add_include_path(s, path); | ||
| 196 | } | ||
| 197 | path = getenv("CPATH"); | ||
| 198 | if(path != NULL) { | ||
| 199 | tcc_add_include_path(s, path); | ||
| 200 | } | ||
| 201 | path = getenv("LIBRARY_PATH"); | ||
| 202 | if(path != NULL) { | ||
| 203 | tcc_add_library_path(s, path); | ||
| 204 | } | ||
| 205 | } | ||
| 206 | |||
| 204 | static char *default_outputfile(TCCState *s, const char *first_file) | 207 | static char *default_outputfile(TCCState *s, const char *first_file) |
| 205 | { | 208 | { |
| 206 | char buf[1024]; | 209 | char buf[1024]; |
| @@ -265,9 +268,6 @@ redo: · 58 unmodified lines | |||
| 265 | #endif | 268 | #endif |
| 266 | if (opt == OPT_V) | 269 | if (opt == OPT_V) |
| 267 | return 0; | 270 | return 0; |
| 268 | |||
| 269 | tcc_set_environment(s); | ||
| 270 | |||
| 271 | if (opt == OPT_PRINT_DIRS) { | 271 | if (opt == OPT_PRINT_DIRS) { |
| 272 | /* initialize search dirs */ | 272 | /* initialize search dirs */ |
| 273 | tcc_set_output_type(s, TCC_OUTPUT_MEMORY); | 273 | tcc_set_output_type(s, TCC_OUTPUT_MEMORY); |
| @@ -287,8 +287,8 @@ redo: · 13 unmodified lines | |||
| 287 | if (!s->ppfp) | 287 | if (!s->ppfp) |
| 288 | tcc_error("could not write '%s'", s->outfile); | 288 | tcc_error("could not write '%s'", s->outfile); |
| 289 | } | 289 | } |
| 290 | } else if (s->output_type == TCC_OUTPUT_OBJ) { | 290 | } else if (s->output_type == TCC_OUTPUT_OBJ && !s->option_r) { |
| 291 | if (s->nb_libraries != 0 && !s->option_r) | 291 | if (s->nb_libraries) |
| 292 | tcc_error("cannot specify libraries with -c"); | 292 | tcc_error("cannot specify libraries with -c"); |
| 293 | if (n > 1 && s->outfile) | 293 | if (n > 1 && s->outfile) |
| 294 | tcc_error("cannot specify output file with -c many files"); | 294 | tcc_error("cannot specify output file with -c many files"); |
| @@ -301,6 +301,7 @@ redo: · 6 unmodified lines | |||
| 301 | start_time = getclock_ms(); | 301 | start_time = getclock_ms(); |
| 302 | } | 302 | } |
| 303 | 303 | ||
| 304 | set_environment(s); | ||
| 304 | if (s->output_type == 0) | 305 | if (s->output_type == 0) |
| 305 | s->output_type = TCC_OUTPUT_EXE; | 306 | s->output_type = TCC_OUTPUT_EXE; |
| 306 | tcc_set_output_type(s, s->output_type); | 307 | tcc_set_output_type(s, s->output_type); |
| @@ -323,7 +324,8 @@ redo: · 16 unmodified lines | |||
| 323 | } | 324 | } |
| 324 | s->filetype = 0; | 325 | s->filetype = 0; |
| 325 | s->alacarte_link = 1; | 326 | s->alacarte_link = 1; |
| 326 | if (ret || --n == 0 || s->output_type == TCC_OUTPUT_OBJ) | 327 | if (ret || --n == 0 |
| 328 | || (s->output_type == TCC_OUTPUT_OBJ && !s->option_r)) | ||
| 327 | break; | 329 | break; |
| 328 | } | 330 | } |
| 329 | 331 | ||
| @@ -615,9 +615,7 @@ struct TCCState { · 614 unmodified lines | |||
| 615 | /* C language options */ | 615 | /* C language options */ |
| 616 | int char_is_unsigned; | 616 | int char_is_unsigned; |
| 617 | int leading_underscore; | 617 | int leading_underscore; |
| 618 | int ms_extensions; /* allow nested named struct w/o identifier behave like unnamed */ | 618 | int ms_extensions; /* allow nested named struct w/o identifier behave like unnamed */ |
| 619 | int old_struct_init_code; /* use old algorithm to init array in struct when there is no '{' used. | ||
| 620 | Liuux 2.4.26 can't find initrd when compiled with a new algorithm */ | ||
| 621 | int dollars_in_identifiers; /* allows '$' char in indentifiers */ | 619 | int dollars_in_identifiers; /* allows '$' char in indentifiers */ |
| 622 | int ms_bitfields; /* if true, emulate MS algorithm for aligning bitfields */ | 620 | int ms_bitfields; /* if true, emulate MS algorithm for aligning bitfields */ |
| 623 | 621 | ||
| @@ -1147,10 +1145,8 @@ ST_FUNC int tcc_add_dll(TCCState *s, const char *filename, int flags); · 523 unmodified lines | |||
| 1147 | 1145 | ||
| 1148 | ST_FUNC void tcc_add_pragma_libs(TCCState *s1); | 1146 | ST_FUNC void tcc_add_pragma_libs(TCCState *s1); |
| 1149 | PUB_FUNC int tcc_add_library_err(TCCState *s, const char *f); | 1147 | PUB_FUNC int tcc_add_library_err(TCCState *s, const char *f); |
| 1150 | |||
| 1151 | PUB_FUNC void tcc_print_stats(TCCState *s, unsigned total_time); | 1148 | PUB_FUNC void tcc_print_stats(TCCState *s, unsigned total_time); |
| 1152 | PUB_FUNC int tcc_parse_args(TCCState *s, int *argc, char ***argv, int optind); | 1149 | PUB_FUNC int tcc_parse_args(TCCState *s, int *argc, char ***argv, int optind); |
| 1153 | PUB_FUNC void tcc_set_environment(TCCState *s); | ||
| 1154 | #ifdef _WIN32 | 1150 | #ifdef _WIN32 |
| 1155 | ST_FUNC char *normalize_slashes(char *path); | 1151 | ST_FUNC char *normalize_slashes(char *path); |
| 1156 | #endif | 1152 | #endif |
| @@ -1276,8 +1272,15 @@ ST_DATA int func_vc; · 119 unmodified lines | |||
| 1276 | ST_DATA int last_line_num, last_ind, func_ind; /* debug last line number and pc */ | 1272 | ST_DATA int last_line_num, last_ind, func_ind; /* debug last line number and pc */ |
| 1277 | ST_DATA const char *funcname; | 1273 | ST_DATA const char *funcname; |
| 1278 | 1274 | ||
| 1275 | ST_FUNC void tcc_debug_start(TCCState *s1); | ||
| 1276 | ST_FUNC void tcc_debug_end(TCCState *s1); | ||
| 1277 | ST_FUNC void tcc_debug_funcstart(TCCState *s1, Sym *sym); | ||
| 1278 | ST_FUNC void tcc_debug_funcend(TCCState *s1, int size); | ||
| 1279 | ST_FUNC void tcc_debug_line(TCCState *s1); | ||
| 1280 | |||
| 1279 | ST_FUNC void tccgen_start(TCCState *s1); | 1281 | ST_FUNC void tccgen_start(TCCState *s1); |
| 1280 | ST_FUNC void tccgen_end(TCCState *s1); | 1282 | ST_FUNC void tccgen_end(TCCState *s1); |
| 1283 | |||
| 1281 | ST_FUNC void free_inline_functions(TCCState *s); | 1284 | ST_FUNC void free_inline_functions(TCCState *s); |
| 1282 | ST_FUNC void check_vstack(void); | 1285 | ST_FUNC void check_vstack(void); |
| 1283 | 1286 | ||
| @@ -926,10 +926,13 @@ static int tcc_assemble_internal(TCCState *s1, int do_preprocess, int global) · 925 unmodified lines | |||
| 926 | set_idnum('.', IS_ID); | 926 | set_idnum('.', IS_ID); |
| 927 | if (do_preprocess) | 927 | if (do_preprocess) |
| 928 | parse_flags |= PARSE_FLAG_PREPROCESS; | 928 | parse_flags |= PARSE_FLAG_PREPROCESS; |
| 929 | next(); | ||
| 930 | for(;;) { | 929 | for(;;) { |
| 930 | next(); | ||
| 931 | if (tok == TOK_EOF) | 931 | if (tok == TOK_EOF) |
| 932 | break; | 932 | break; |
| 933 | /* generate line number info */ | ||
| 934 | if (global && s1->do_debug) | ||
| 935 | tcc_debug_line(s1); | ||
| 933 | parse_flags |= PARSE_FLAG_LINEFEED; /* XXX: suppress that hack */ | 936 | parse_flags |= PARSE_FLAG_LINEFEED; /* XXX: suppress that hack */ |
| 934 | redo: | 937 | redo: |
| 935 | if (tok == '#') { | 938 | if (tok == '#') { |
| @@ -981,15 +984,12 @@ static int tcc_assemble_internal(TCCState *s1, int do_preprocess, int global) · 45 unmodified lines | |||
| 981 | } | 984 | } |
| 982 | } | 985 | } |
| 983 | /* end of line */ | 986 | /* end of line */ |
| 984 | if (tok != ';' && tok != TOK_LINEFEED){ | 987 | if (tok != ';' && tok != TOK_LINEFEED) |
| 985 | expect("end of line"); | 988 | expect("end of line"); |
| 986 | } | ||
| 987 | parse_flags &= ~PARSE_FLAG_LINEFEED; /* XXX: suppress that hack */ | 989 | parse_flags &= ~PARSE_FLAG_LINEFEED; /* XXX: suppress that hack */ |
| 988 | next(); | ||
| 989 | } | 990 | } |
| 990 | 991 | ||
| 991 | asm_free_labels(s1); | 992 | asm_free_labels(s1); |
| 992 | |||
| 993 | return 0; | 993 | return 0; |
| 994 | } | 994 | } |
| 995 | 995 | ||
| @@ -1001,24 +1001,19 @@ ST_FUNC int tcc_assemble(TCCState *s1, int do_preprocess) · 5 unmodified lines | |||
| 1001 | 1001 | ||
| 1002 | define_start = define_stack; | 1002 | define_start = define_stack; |
| 1003 | preprocess_start(s1); | 1003 | preprocess_start(s1); |
| 1004 | tcc_debug_start(s1); | ||
| 1004 | 1005 | ||
| 1005 | /* default section is text */ | 1006 | /* default section is text */ |
| 1006 | cur_text_section = text_section; | 1007 | cur_text_section = text_section; |
| 1007 | ind = cur_text_section->data_offset; | 1008 | ind = cur_text_section->data_offset; |
| 1008 | nocode_wanted = 0; | 1009 | nocode_wanted = 0; |
| 1009 | 1010 | ||
| 1010 | /* an elf symbol of type STT_FILE must be put so that STB_LOCAL | ||
| 1011 | symbols can be safely used */ | ||
| 1012 | put_elf_sym(symtab_section, 0, 0, | ||
| 1013 | ELFW(ST_INFO)(STB_LOCAL, STT_FILE), 0, | ||
| 1014 | SHN_ABS, file->filename); | ||
| 1015 | |||
| 1016 | ret = tcc_assemble_internal(s1, do_preprocess, 1); | 1011 | ret = tcc_assemble_internal(s1, do_preprocess, 1); |
| 1017 | 1012 | ||
| 1018 | cur_text_section->data_offset = ind; | 1013 | cur_text_section->data_offset = ind; |
| 1019 | 1014 | ||
| 1015 | tcc_debug_end(s1); | ||
| 1020 | free_defines(define_start); | 1016 | free_defines(define_start); |
| 1021 | |||
| 1022 | return ret; | 1017 | return ret; |
| 1023 | } | 1018 | } |
| 1024 | 1019 | ||
| @@ -140,27 +140,9 @@ void pv (const char *lbl, int a, int b) · 139 unmodified lines | |||
| 140 | #endif | 140 | #endif |
| 141 | 141 | ||
| 142 | /* ------------------------------------------------------------------------- */ | 142 | /* ------------------------------------------------------------------------- */ |
| 143 | ST_FUNC void tccgen_start(TCCState *s1) | 143 | /* start of translation unit info */ |
| 144 | ST_FUNC void tcc_debug_start(TCCState *s1) | ||
| 144 | { | 145 | { |
| 145 | cur_text_section = NULL; | ||
| 146 | funcname = ""; | ||
| 147 | anon_sym = SYM_FIRST_ANOM; | ||
| 148 | section_sym = 0; | ||
| 149 | const_wanted = 0; | ||
| 150 | nocode_wanted = 1; | ||
| 151 | |||
| 152 | /* define some often used types */ | ||
| 153 | int_type.t = VT_INT; | ||
| 154 | char_pointer_type.t = VT_BYTE; | ||
| 155 | mk_pointer(&char_pointer_type); | ||
| 156 | #if PTR_SIZE == 4 | ||
| 157 | size_type.t = VT_INT; | ||
| 158 | #else | ||
| 159 | size_type.t = VT_LLONG; | ||
| 160 | #endif | ||
| 161 | func_old_type.t = VT_FUNC; | ||
| 162 | func_old_type.ref = sym_push(SYM_FIELD, &int_type, FUNC_CDECL, FUNC_OLD); | ||
| 163 | |||
| 164 | if (s1->do_debug) { | 146 | if (s1->do_debug) { |
| 165 | char buf[512]; | 147 | char buf[512]; |
| 166 | 148 | ||
| @@ -177,12 +159,91 @@ ST_FUNC void tccgen_start(TCCState *s1) · 10 unmodified lines | |||
| 177 | text_section->data_offset, text_section, section_sym); | 159 | text_section->data_offset, text_section, section_sym); |
| 178 | put_stabs_r(file->filename, N_SO, 0, 0, | 160 | put_stabs_r(file->filename, N_SO, 0, 0, |
| 179 | text_section->data_offset, text_section, section_sym); | 161 | text_section->data_offset, text_section, section_sym); |
| 162 | last_ind = 0; | ||
| 163 | last_line_num = 0; | ||
| 180 | } | 164 | } |
| 165 | |||
| 181 | /* an elf symbol of type STT_FILE must be put so that STB_LOCAL | 166 | /* an elf symbol of type STT_FILE must be put so that STB_LOCAL |
| 182 | symbols can be safely used */ | 167 | symbols can be safely used */ |
| 183 | put_elf_sym(symtab_section, 0, 0, | 168 | put_elf_sym(symtab_section, 0, 0, |
| 184 | ELFW(ST_INFO)(STB_LOCAL, STT_FILE), 0, | 169 | ELFW(ST_INFO)(STB_LOCAL, STT_FILE), 0, |
| 185 | SHN_ABS, file->filename); | 170 | SHN_ABS, file->filename); |
| 171 | } | ||
| 172 | |||
| 173 | /* put end of translation unit info */ | ||
| 174 | ST_FUNC void tcc_debug_end(TCCState *s1) | ||
| 175 | { | ||
| 176 | if (!s1->do_debug) | ||
| 177 | return; | ||
| 178 | put_stabs_r(NULL, N_SO, 0, 0, | ||
| 179 | text_section->data_offset, text_section, section_sym); | ||
| 180 | |||
| 181 | } | ||
| 182 | |||
| 183 | /* generate line number info */ | ||
| 184 | ST_FUNC void tcc_debug_line(TCCState *s1) | ||
| 185 | { | ||
| 186 | if (!s1->do_debug) | ||
| 187 | return; | ||
| 188 | if ((last_line_num != file->line_num || last_ind != ind)) { | ||
| 189 | put_stabn(N_SLINE, 0, file->line_num, ind - func_ind); | ||
| 190 | last_ind = ind; | ||
| 191 | last_line_num = file->line_num; | ||
| 192 | } | ||
| 193 | } | ||
| 194 | |||
| 195 | /* put function symbol */ | ||
| 196 | ST_FUNC void tcc_debug_funcstart(TCCState *s1, Sym *sym) | ||
| 197 | { | ||
| 198 | char buf[512]; | ||
| 199 | |||
| 200 | if (!s1->do_debug) | ||
| 201 | return; | ||
| 202 | |||
| 203 | /* stabs info */ | ||
| 204 | /* XXX: we put here a dummy type */ | ||
| 205 | snprintf(buf, sizeof(buf), "%s:%c1", | ||
| 206 | funcname, sym->type.t & VT_STATIC ? 'f' : 'F'); | ||
| 207 | put_stabs_r(buf, N_FUN, 0, file->line_num, 0, | ||
| 208 | cur_text_section, sym->c); | ||
| 209 | /* //gr gdb wants a line at the function */ | ||
| 210 | put_stabn(N_SLINE, 0, file->line_num, 0); | ||
| 211 | |||
| 212 | last_ind = 0; | ||
| 213 | last_line_num = 0; | ||
| 214 | } | ||
| 215 | |||
| 216 | /* put function size */ | ||
| 217 | ST_FUNC void tcc_debug_funcend(TCCState *s1, int size) | ||
| 218 | { | ||
| 219 | if (!s1->do_debug) | ||
| 220 | return; | ||
| 221 | put_stabn(N_FUN, 0, 0, size); | ||
| 222 | } | ||
| 223 | |||
| 224 | /* ------------------------------------------------------------------------- */ | ||
| 225 | ST_FUNC void tccgen_start(TCCState *s1) | ||
| 226 | { | ||
| 227 | cur_text_section = NULL; | ||
| 228 | funcname = ""; | ||
| 229 | anon_sym = SYM_FIRST_ANOM; | ||
| 230 | section_sym = 0; | ||
| 231 | const_wanted = 0; | ||
| 232 | nocode_wanted = 1; | ||
| 233 | |||
| 234 | /* define some often used types */ | ||
| 235 | int_type.t = VT_INT; | ||
| 236 | char_pointer_type.t = VT_BYTE; | ||
| 237 | mk_pointer(&char_pointer_type); | ||
| 238 | #if PTR_SIZE == 4 | ||
| 239 | size_type.t = VT_INT; | ||
| 240 | #else | ||
| 241 | size_type.t = VT_LLONG; | ||
| 242 | #endif | ||
| 243 | func_old_type.t = VT_FUNC; | ||
| 244 | func_old_type.ref = sym_push(SYM_FIELD, &int_type, FUNC_CDECL, FUNC_OLD); | ||
| 245 | |||
| 246 | tcc_debug_start(s1); | ||
| 186 | 247 | ||
| 187 | #ifdef TCC_TARGET_ARM | 248 | #ifdef TCC_TARGET_ARM |
| 188 | arm_init(s1); | 249 | arm_init(s1); |
| @@ -194,10 +255,7 @@ ST_FUNC void tccgen_end(TCCState *s1) · 5 unmodified lines | |||
| 194 | gen_inline_functions(s1); | 255 | gen_inline_functions(s1); |
| 195 | check_vstack(); | 256 | check_vstack(); |
| 196 | /* end of translation unit info */ | 257 | /* end of translation unit info */ |
| 197 | if (s1->do_debug) { | 258 | tcc_debug_end(s1); |
| 198 | put_stabs_r(NULL, N_SO, 0, 0, | ||
| 199 | text_section->data_offset, text_section, section_sym); | ||
| 200 | } | ||
| 201 | } | 259 | } |
| 202 | 260 | ||
| 203 | /* ------------------------------------------------------------------------- */ | 261 | /* ------------------------------------------------------------------------- */ |
| @@ -5567,12 +5625,8 @@ static void block(int *bsym, int *csym, int is_expr) · 5363 unmodified lines | |||
| 5567 | Sym *s; | 5625 | Sym *s; |
| 5568 | 5626 | ||
| 5569 | /* generate line number info */ | 5627 | /* generate line number info */ |
| 5570 | if (tcc_state->do_debug && | 5628 | if (tcc_state->do_debug) |
| 5571 | (last_line_num != file->line_num || last_ind != ind)) { | 5629 | tcc_debug_line(tcc_state); |
| 5572 | put_stabn(N_SLINE, 0, file->line_num, ind - func_ind); | ||
| 5573 | last_ind = ind; | ||
| 5574 | last_line_num = file->line_num; | ||
| 5575 | } | ||
| 5576 | 5630 | ||
| 5577 | if (is_expr) { | 5631 | if (is_expr) { |
| 5578 | /* default return value is (void) */ | 5632 | /* default return value is (void) */ |
| @@ -6741,22 +6795,6 @@ static void decl_initializer_alloc(CType *type, AttributeDef *ad, int r, · 1162 unmodified lines | |||
| 6741 | } | 6795 | } |
| 6742 | } | 6796 | } |
| 6743 | 6797 | ||
| 6744 | static void put_func_debug(Sym *sym) | ||
| 6745 | { | ||
| 6746 | char buf[512]; | ||
| 6747 | |||
| 6748 | /* stabs info */ | ||
| 6749 | /* XXX: we put here a dummy type */ | ||
| 6750 | snprintf(buf, sizeof(buf), "%s:%c1", | ||
| 6751 | funcname, sym->type.t & VT_STATIC ? 'f' : 'F'); | ||
| 6752 | put_stabs_r(buf, N_FUN, 0, file->line_num, 0, | ||
| 6753 | cur_text_section, sym->c); | ||
| 6754 | /* //gr gdb wants a line at the function */ | ||
| 6755 | put_stabn(N_SLINE, 0, file->line_num, 0); | ||
| 6756 | last_ind = 0; | ||
| 6757 | last_line_num = 0; | ||
| 6758 | } | ||
| 6759 | |||
| 6760 | /* parse an old style function declaration list */ | 6798 | /* parse an old style function declaration list */ |
| 6761 | /* XXX: check multiple parameter */ | 6799 | /* XXX: check multiple parameter */ |
| 6762 | static void func_decl_list(Sym *func_sym) | 6800 | static void func_decl_list(Sym *func_sym) |
| @@ -6820,15 +6858,12 @@ static void gen_function(Sym *sym) · 57 unmodified lines | |||
| 6820 | vla_sp_loc = -1; | 6858 | vla_sp_loc = -1; |
| 6821 | vla_sp_root_loc = -1; | 6859 | vla_sp_root_loc = -1; |
| 6822 | /* put debug symbol */ | 6860 | /* put debug symbol */ |
| 6823 | if (tcc_state->do_debug) | 6861 | tcc_debug_funcstart(tcc_state, sym); |
| 6824 | put_func_debug(sym); | ||
| 6825 | |||
| 6826 | /* push a dummy symbol to enable local sym storage */ | 6862 | /* push a dummy symbol to enable local sym storage */ |
| 6827 | sym_push2(&local_stack, SYM_FIELD, 0, 0); | 6863 | sym_push2(&local_stack, SYM_FIELD, 0, 0); |
| 6828 | local_scope = 1; /* for function parameters */ | 6864 | local_scope = 1; /* for function parameters */ |
| 6829 | gfunc_prolog(&sym->type); | 6865 | gfunc_prolog(&sym->type); |
| 6830 | local_scope = 0; | 6866 | local_scope = 0; |
| 6831 | |||
| 6832 | rsym = 0; | 6867 | rsym = 0; |
| 6833 | block(NULL, NULL, 0); | 6868 | block(NULL, NULL, 0); |
| 6834 | nocode_wanted = 0; | 6869 | nocode_wanted = 0; |
| @@ -6847,9 +6882,7 @@ static void gen_function(Sym *sym) · 12 unmodified lines | |||
| 6847 | if (sym->type.t & VT_WEAK) | 6882 | if (sym->type.t & VT_WEAK) |
| 6848 | weaken_symbol(sym); | 6883 | weaken_symbol(sym); |
| 6849 | apply_visibility(sym, &sym->type); | 6884 | apply_visibility(sym, &sym->type); |
| 6850 | if (tcc_state->do_debug) { | 6885 | tcc_debug_funcend(tcc_state, ind - func_ind); |
| 6851 | put_stabn(N_FUN, 0, 0, ind - func_ind); | ||
| 6852 | } | ||
| 6853 | /* It's better to crash than to generate wrong code */ | 6886 | /* It's better to crash than to generate wrong code */ |
| 6854 | cur_text_section = NULL; | 6887 | cur_text_section = NULL; |
| 6855 | funcname = ""; /* for safety */ | 6888 | funcname = ""; /* for safety */ |
| @@ -36,13 +36,13 @@ endif · 35 unmodified lines | |||
| 36 | ifeq ($(TARGETOS),Darwin) | 36 | ifeq ($(TARGETOS),Darwin) |
| 37 | TESTS := $(filter-out hello-exe test3 $(BTESTS),$(TESTS)) | 37 | TESTS := $(filter-out hello-exe test3 $(BTESTS),$(TESTS)) |
| 38 | endif | 38 | endif |
| 39 | ifeq (,$(filter arm64 i386 x86-64,$(ARCH))) | 39 | ifeq (,$(filter arm64 i386 x86_64,$(ARCH))) |
| 40 | TESTS := $(filter-out vla_test-run,$(TESTS)) | 40 | TESTS := $(filter-out vla_test-run,$(TESTS)) |
| 41 | endif | 41 | endif |
| 42 | ifeq ($(CONFIG_arm_eabi),yes) | 42 | ifeq ($(CONFIG_arm_eabi),yes) |
| 43 | TESTS := $(filter-out test3,$(TESTS)) | 43 | TESTS := $(filter-out test3,$(TESTS)) |
| 44 | endif | 44 | endif |
| 45 | ifeq (,$(filter i386 x86-64,$(ARCH))) | 45 | ifeq (,$(filter i386 x86_64,$(ARCH))) |
| 46 | TESTS := $(filter-out dlltest,$(TESTS)) | 46 | TESTS := $(filter-out dlltest,$(TESTS)) |
| 47 | endif | 47 | endif |
| 48 | 48 | ||
| @@ -22,10 +22,10 @@ endif · 21 unmodified lines | |||
| 22 | ifeq ($(TARGETOS),Darwin) | 22 | ifeq ($(TARGETOS),Darwin) |
| 23 | SKIP += 40_stdio.test | 23 | SKIP += 40_stdio.test |
| 24 | endif | 24 | endif |
| 25 | ifeq ($(ARCH),x86-64) | 25 | ifeq ($(ARCH),x86_64) |
| 26 | SKIP += 73_arm64.test | 26 | SKIP += 73_arm64.test |
| 27 | endif | 27 | endif |
| 28 | ifeq (,$(filter i386 x86-64,$(ARCH))) | 28 | ifeq (,$(filter i386 x86_64,$(ARCH))) |
| 29 | SKIP += 85_asm-outside-function.test | 29 | SKIP += 85_asm-outside-function.test |
| 30 | endif | 30 | endif |
| 31 | 31 | ||
| @@ -24,11 +24,9 @@ TARGET = $(CPU) · 23 unmodified lines | |||
| 24 | ifeq ($(TARGET), 64) | 24 | ifeq ($(TARGET), 64) |
| 25 | TFLAGS = -m$(TARGET) -DTCC_TARGET_X86_64 | 25 | TFLAGS = -m$(TARGET) -DTCC_TARGET_X86_64 |
| 26 | TARCH = x86_64 | 26 | TARCH = x86_64 |
| 27 | CARCH = x86-64 | ||
| 28 | else | 27 | else |
| 29 | TFLAGS = -m$(TARGET) -DTCC_TARGET_I386 | 28 | TFLAGS = -m$(TARGET) -DTCC_TARGET_I386 |
| 30 | TARCH = i386 | 29 | TARCH = i386 |
| 31 | CARCH = i386 | ||
| 32 | endif | 30 | endif |
| 33 | 31 | ||
| 34 | all: pre bootstrap libs rebuild | 32 | all: pre bootstrap libs rebuild |
| @@ -36,7 +34,7 @@ all: pre bootstrap libs rebuild · 1 unmodified line | |||
| 36 | @ls -ls *.exe | 34 | @ls -ls *.exe |
| 37 | 35 | ||
| 38 | pre: | 36 | pre: |
| 39 | @echo ARCH=$(CARCH) 1> ../config.mak | 37 | @echo ARCH=$(TARCH) 1> ../config.mak |
| 40 | @echo TARGETOS=Windows 1>> ../config.mak | 38 | @echo TARGETOS=Windows 1>> ../config.mak |
| 41 | @echo CONFIG_WIN32=yes 1>> ../config.mak | 39 | @echo CONFIG_WIN32=yes 1>> ../config.mak |
| 42 | @echo TOPSRC=$$\(TOP\) 1>> ../config.mak | 40 | @echo TOPSRC=$$\(TOP\) 1>> ../config.mak |
| @@ -139,6 +139,18 @@ typedef struct localeinfo_struct _locale_tstruct,*_locale_t; · 138 unmodified lines | |||
| 139 | #define NOSERVICE 1 | 139 | #define NOSERVICE 1 |
| 140 | #define NOMCX 1 | 140 | #define NOMCX 1 |
| 141 | #define NOIME 1 | 141 | #define NOIME 1 |
| 142 | #define __INTRIN_H_ | ||
| 143 | #ifndef DUMMYUNIONNAME | ||
| 144 | # define DUMMYUNIONNAME | ||
| 145 | # define DUMMYUNIONNAME1 | ||
| 146 | # define DUMMYUNIONNAME2 | ||
| 147 | # define DUMMYUNIONNAME3 | ||
| 148 | # define DUMMYUNIONNAME4 | ||
| 149 | # define DUMMYUNIONNAME5 | ||
| 150 | #endif | ||
| 151 | #ifndef DUMMYSTRUCTNAME | ||
| 152 | # define DUMMYSTRUCTNAME | ||
| 153 | #endif | ||
| 142 | #ifndef WINVER | 154 | #ifndef WINVER |
| 143 | # define WINVER 0x0502 | 155 | # define WINVER 0x0502 |
| 144 | #endif | 156 | #endif |
| @@ -73,15 +73,18 @@ int _runtmain(int argc, /* as tcc passed in */ char **argv) · 72 unmodified lines | |||
| 73 | _startupinfo start_info = {0}; | 73 | _startupinfo start_info = {0}; |
| 74 | 74 | ||
| 75 | __tgetmainargs(&wargc, &wargv, &wenv, _dowildcard, &start_info); | 75 | __tgetmainargs(&wargc, &wargv, &wenv, _dowildcard, &start_info); |
| 76 | /* may be wrong when tcc has received wildcards (*.c) */ | ||
| 76 | if (argc < wargc) | 77 | if (argc < wargc) |
| 77 | wargv += wargc - argc; | 78 | wargv += wargc - argc; |
| 79 | else | ||
| 80 | argc = wargc; | ||
| 78 | #define argv wargv | 81 | #define argv wargv |
| 79 | #endif | 82 | #endif |
| 80 | 83 | ||
| 81 | #ifdef __i386 | 84 | #ifdef __i386 |
| 82 | _controlfp(_PC_53, _MCW_PC); | 85 | _controlfp(_PC_53, _MCW_PC); |
| 83 | #endif | 86 | #endif |
| 84 | return _tmain(argc, argv, NULL); | 87 | return _tmain(argc, argv, _tenviron); |
| 85 | } | 88 | } |
| 86 | 89 | ||
| 87 | // ============================================= | 90 | // ============================================= |
| @@ -336,6 +336,10 @@ GetWindow · 335 unmodified lines | |||
| 336 | GetWindowContextHelpId | 336 | GetWindowContextHelpId |
| 337 | GetWindowDC | 337 | GetWindowDC |
| 338 | GetWindowInfo | 338 | GetWindowInfo |
| 339 | GetWindowLongPtrA | ||
| 340 | GetWindowLongPtrW | ||
| 341 | SetWindowLongPtrA | ||
| 342 | SetWindowLongPtrW | ||
| 339 | GetWindowLongA | 343 | GetWindowLongA |
| 340 | GetWindowLongW | 344 | GetWindowLongW |
| 341 | GetWindowModuleFileNameA | 345 | GetWindowModuleFileNameA |
| @@ -80,6 +80,8 @@ int _runtwinmain(int argc, /* as tcc passed in */ char **argv) · 79 unmodified lines | |||
| 80 | __tgetmainargs(&wargc, &wargv, &wenv, 0, &start_info); | 80 | __tgetmainargs(&wargc, &wargv, &wenv, 0, &start_info); |
| 81 | if (argc < wargc) | 81 | if (argc < wargc) |
| 82 | wargv += wargc - argc; | 82 | wargv += wargc - argc; |
| 83 | else | ||
| 84 | argc = wargc; | ||
| 83 | #define argv wargv | 85 | #define argv wargv |
| 84 | #endif | 86 | #endif |
| 85 | 87 | ||