History

tcc: re-enable correct option -r support

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

grischka committed 9 years ago

Commit 5f33d311 parent 399237818 files · +178 −151Browse files

Unified · Split

18 files
  1. Changelog +2 −2
  2. Makefile +3 −3
  3. README +6 −15
  4. configure +5 −5
  5. lib/Makefile +5 −2
  6. libtcc.c +0 −19
  7. tcc-doc.texi +2 −2
  8. tcc.c +27 −25
  9. tcc.h +8 −5
  10. tccasm.c +7 −12
  11. tccgen.c +86 −53
  12. tests/Makefile +2 −2
  13. tests/tests2/Makefile +2 −2
  14. win32/Makefile +1 −3
  15. win32/include/_mingw.h +12 −0
  16. win32/lib/crt1.c +4 −1
  17. win32/lib/user32.def +4 −0
  18. win32/lib/wincrt1.c +2 −0
Changelog+2−2
@@ -16,14 +16,14 @@ Platforms: · 15 unmodified lines
1616 - vastly improved support for ARM hard float calling convention
1717 (Thomas Preud'homme, Daniel Glöckner)
1818 - 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)
2020 - ABI tests with native compiler using libtcc (James Lyon)
2121 - UNICODE startup code supports wmain and wWinMain (YX Hao)
2222
2323 Features:
2424 - VLA (variable length array) improved (James Lyon, Pip Cet)
2525 - 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)
2727 - simple dead code suppression (Edmund Grimley Evans, Michael Matz, grischka)
2828 - implement round/fmin/fmax etc. math on windows (Avi Halachmi)
2929 - #pragma once support (Sergey Korshunoff, Vlad Vissoultchev, ...)
Makefile+3−3
@@ -56,7 +56,7 @@ LDFLAGS_P = $(LDFLAGS) · 55 unmodified lines
5656
5757 CONFIG_$(ARCH) = yes
5858 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
6060 NATIVE_DEFINES_$(CONFIG_WIN32) += -DTCC_TARGET_PE
6161 NATIVE_DEFINES_$(CONFIG_uClibc) += -DTCC_UCLIBC
6262 NATIVE_DEFINES_$(CONFIG_arm) += -DTCC_TARGET_ARM
@@ -95,7 +95,7 @@ ARM64_FILES = $(CORE_FILES) arm64-gen.c arm64-link.c · 32 unmodified lines
9595 C67_FILES = $(CORE_FILES) c67-gen.c c67-link.c tcccoff.c
9696
9797 ifdef CONFIG_WIN32
98− ifeq ($(ARCH),x86-64)
98+ ifeq ($(ARCH),x86_64)
9999 NATIVE_FILES=$(WIN64_FILES)
100100 PROGS_CROSS=$(WIN32_CROSS) $(X64_CROSS) $(ARM_CROSS) $(ARM64_CROSS) $(C67_CROSS) $(WINCE_CROSS)
101101 LIBTCC1_CROSS=lib/i386-win32/libtcc1.a
@@ -110,7 +110,7 @@ NATIVE_FILES=$(I386_FILES) · 8 unmodified lines
110110 PROGS_CROSS=$(X64_CROSS) $(WIN32_CROSS) $(WIN64_CROSS) $(ARM_CROSS) $(ARM64_CROSS) $(C67_CROSS) $(WINCE_CROSS)
111111 LIBTCC1_CROSS=lib/i386-win32/libtcc1.a lib/x86_64-win32/libtcc1.a
112112
113−else ifeq ($(ARCH),x86-64)
113+else ifeq ($(ARCH),x86_64)
114114 NATIVE_FILES=$(X86_64_FILES)
115115 PROGS_CROSS=$(I386_CROSS) $(WIN32_CROSS) $(WIN64_CROSS) $(ARM_CROSS) $(ARM64_CROSS) $(C67_CROSS) $(WINCE_CROSS)
116116 LIBTCC1_CROSS=lib/i386-win32/libtcc1.a lib/x86_64-win32/libtcc1.a
README+6−15
@@ -28,28 +28,19 @@ Features: · 27 unmodified lines
2828 Documentation:
2929 -------------
3030
31−1) Installation on a i386/x86_64/arm Linux/OSX/FreeBSD host (for Windows read tcc-win32.txt)
32−
33−Note: For OSX and FreeBSD, gmake should be used instead of make.
31+1) Installation on a i386/x86_64/arm Linux/OSX/FreeBSD host
3432
3533 ./configure
3634 make
3735 make test
3836 make install
3937
40−Alternatively, out-of-tree builds are supported: you may use different
41−directories to hold build objects, kept separate from your source tree:
42−
43− mkdir _build
44− cd _build
45− ../configure
46− make
47− make test
48− make install
38+ Notes: For OSX and FreeBSD, gmake should be used instead of make.
39+ For Windows read tcc-win32.txt.
4940
50−Texi2html must be installed to compile the doc.
51−By default, tcc is installed in /usr/local/bin.
52−./configure --help shows configuration options.
41+makeinfo must be installed to compile the doc. By default, tcc is
42+installed in /usr/local/bin. ./configure --help shows configuration
43+options.
5344
5445
5546 2) Introduction
configure+5−5
@@ -163,8 +163,8 @@ case "$cpu" in · 162 unmodified lines
163163 x86|i386|i486|i586|i686|i86pc|BePC|i686-AT386)
164164 cpu="x86"
165165 ;;
166− x86_64|amd64)
167− cpu="x86-64"
166+ x86_64|amd64|x86-64)
167+ cpu="x86_64"
168168 ;;
169169 arm*)
170170 case "$cpu" in
@@ -332,7 +332,7 @@ if test -z "$cross_prefix" ; then · 161 unmodified lines
332332 fi
333333
334334 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
336336 if test -f "/usr/lib64/crti.o" ; then
337337 tcc_lddir="lib64"
338338 fi
@@ -453,8 +453,8 @@ echo "#define GCC_MINOR $gcc_minor" >> $TMPH · 114 unmodified lines
453453
454454 if test "$cpu" = "x86" ; then
455455 echo "ARCH=i386" >> config.mak
456−elif test "$cpu" = "x86-64" ; then
457− echo "ARCH=x86-64" >> config.mak
456+elif test "$cpu" = "x86_64" ; then
457+ echo "ARCH=x86_64" >> config.mak
458458 elif test "$cpu" = "armv4l" ; then
459459 echo "ARCH=arm" >> config.mak
460460 echo "#define TCC_ARM_VERSION $cpuver" >> $TMPH
lib/Makefile+5−2
@@ -9,14 +9,14 @@ VPATH = $(TOPSRC)/lib $(TOPSRC)/win32/lib · 8 unmodified lines
99 ifndef TARGET
1010 # we're building the native libtcc1.a
1111 ifdef CONFIG_WIN32
12− ifeq ($(ARCH),x86-64)
12+ ifeq ($(ARCH),x86_64)
1313 TARGET = x86_64-win32
1414 else
1515 TARGET = i386-win32
1616 endif
1717 else ifeq ($(ARCH),i386)
1818 TARGET = i386
19− else ifeq ($(ARCH),x86-64)
19+ else ifeq ($(ARCH),x86_64)
2020 TARGET = x86_64
2121 else ifeq ($(ARCH),arm)
2222 TARGET = arm
@@ -83,6 +83,9 @@ $(DIR)/%.o : %.c · 60 unmodified lines
8383 $(DIR)/%.o : %.S
8484 $(XCC) -c $< -o $@ $(TGT) $(XFLAGS)
8585
86+$(DIR)/crt1w.o : crt1.c
87+$(DIR)/wincrt1w.o : wincrt1.c
88+
8689 $(OBJ) : $(DIR)/exists
8790
8891 %/exists :
libtcc.c+0−19
@@ -1572,7 +1572,6 @@ static const FlagDef options_f[] = { · 1571 unmodified lines
15721572 { offsetof(TCCState, nocommon), FD_INVERT, "common" },
15731573 { offsetof(TCCState, leading_underscore), 0, "leading-underscore" },
15741574 { offsetof(TCCState, ms_extensions), 0, "ms-extensions" },
1575− { offsetof(TCCState, old_struct_init_code), 0, "old-struct-init-code" },
15761575 { offsetof(TCCState, dollars_in_identifiers), 0, "dollars-in-identifiers" },
15771576 { 0, 0, NULL }
15781577 };
@@ -1984,21 +1983,3 @@ PUB_FUNC void tcc_print_stats(TCCState *s, unsigned total_time) · 405 unmodified lines
19841983 fprintf(stderr, "* %d bytes memory used\n", mem_max_size);
19851984 #endif
19861985 }
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−}
tcc-doc.texi+2−2
@@ -387,10 +387,10 @@ gcc's algorithm. · 386 unmodified lines
387387 Select the float ABI. Possible values: @code{softfp} and @code{hard}
388388
389389 @item -mno-sse
390−Do not use sse registers on x86-64
390+Do not use sse registers on x86_64
391391
392392 @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.
394394
395395 @end table
396396
tcc.c+27−25
@@ -104,9 +104,8 @@ static const char help2[] = · 103 unmodified lines
104104 " signed-char default char is signed\n"
105105 " common use common section instead of bss\n"
106106 " leading-underscore decorate extern symbols\n"
107− " ms-extensions allow struct w/o identifier\n"
107+ " ms-extensions allow anonymous struct in struct\n"
108108 " dollars-in-identifiers allow '$' in C symbols\n"
109− " old-struct-init-code some hack for parsing initializers\n"
110109 "-m... target specific options:\n"
111110 " ms-bitfields use MSVC bitfield layout\n"
112111 #ifdef TCC_TARGET_ARM
@@ -151,32 +150,18 @@ static const char version[] = · 38 unmodified lines
151150 "C67"
152151 #elif defined TCC_TARGET_ARM
153152 "ARM"
154−# ifdef TCC_ARM_HARDFLOAT
155− " Hard Float"
156−# endif
157153 #elif defined TCC_TARGET_ARM64
158154 "AArch64"
159−# ifdef TCC_ARM_HARDFLOAT
155+#endif
156+#ifdef TCC_ARM_HARDFLOAT
160157 " Hard Float"
161−# endif
162158 #endif
163159 #ifdef TCC_TARGET_PE
164160 " Windows"
165−#elif defined(__APPLE__)
166− /* Current Apple OS name as of 2016 */
167− " macOS"
168161 #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
169162 " 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"
178163 #else
179− " Unidentified system"
164+ " Linux"
180165 #endif
181166 ")\n"
182167 ;
@@ -201,6 +186,24 @@ static void print_search_dirs(TCCState *s) · 18 unmodified lines
201186 #endif
202187 }
203188
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+
204207 static char *default_outputfile(TCCState *s, const char *first_file)
205208 {
206209 char buf[1024];
@@ -265,9 +268,6 @@ redo: · 58 unmodified lines
265268 #endif
266269 if (opt == OPT_V)
267270 return 0;
268−
269− tcc_set_environment(s);
270−
271271 if (opt == OPT_PRINT_DIRS) {
272272 /* initialize search dirs */
273273 tcc_set_output_type(s, TCC_OUTPUT_MEMORY);
@@ -287,8 +287,8 @@ redo: · 13 unmodified lines
287287 if (!s->ppfp)
288288 tcc_error("could not write '%s'", s->outfile);
289289 }
290− } else if (s->output_type == TCC_OUTPUT_OBJ) {
291− if (s->nb_libraries != 0 && !s->option_r)
290+ } else if (s->output_type == TCC_OUTPUT_OBJ && !s->option_r) {
291+ if (s->nb_libraries)
292292 tcc_error("cannot specify libraries with -c");
293293 if (n > 1 && s->outfile)
294294 tcc_error("cannot specify output file with -c many files");
@@ -301,6 +301,7 @@ redo: · 6 unmodified lines
301301 start_time = getclock_ms();
302302 }
303303
304+ set_environment(s);
304305 if (s->output_type == 0)
305306 s->output_type = TCC_OUTPUT_EXE;
306307 tcc_set_output_type(s, s->output_type);
@@ -323,7 +324,8 @@ redo: · 16 unmodified lines
323324 }
324325 s->filetype = 0;
325326 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))
327329 break;
328330 }
329331
tcc.h+8−5
@@ -615,9 +615,7 @@ struct TCCState { · 614 unmodified lines
615615 /* C language options */
616616 int char_is_unsigned;
617617 int leading_underscore;
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 */
618+ int ms_extensions; /* allow nested named struct w/o identifier behave like unnamed */
621619 int dollars_in_identifiers; /* allows '$' char in indentifiers */
622620 int ms_bitfields; /* if true, emulate MS algorithm for aligning bitfields */
623621
@@ -1147,10 +1145,8 @@ ST_FUNC int tcc_add_dll(TCCState *s, const char *filename, int flags); · 523 unmodified lines
11471145
11481146 ST_FUNC void tcc_add_pragma_libs(TCCState *s1);
11491147 PUB_FUNC int tcc_add_library_err(TCCState *s, const char *f);
1150−
11511148 PUB_FUNC void tcc_print_stats(TCCState *s, unsigned total_time);
11521149 PUB_FUNC int tcc_parse_args(TCCState *s, int *argc, char ***argv, int optind);
1153−PUB_FUNC void tcc_set_environment(TCCState *s);
11541150 #ifdef _WIN32
11551151 ST_FUNC char *normalize_slashes(char *path);
11561152 #endif
@@ -1276,8 +1272,15 @@ ST_DATA int func_vc; · 119 unmodified lines
12761272 ST_DATA int last_line_num, last_ind, func_ind; /* debug last line number and pc */
12771273 ST_DATA const char *funcname;
12781274
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+
12791281 ST_FUNC void tccgen_start(TCCState *s1);
12801282 ST_FUNC void tccgen_end(TCCState *s1);
1283+
12811284 ST_FUNC void free_inline_functions(TCCState *s);
12821285 ST_FUNC void check_vstack(void);
12831286
tccasm.c+7−12
@@ -926,10 +926,13 @@ static int tcc_assemble_internal(TCCState *s1, int do_preprocess, int global) · 925 unmodified lines
926926 set_idnum('.', IS_ID);
927927 if (do_preprocess)
928928 parse_flags |= PARSE_FLAG_PREPROCESS;
929− next();
930929 for(;;) {
930+ next();
931931 if (tok == TOK_EOF)
932932 break;
933+ /* generate line number info */
934+ if (global && s1->do_debug)
935+ tcc_debug_line(s1);
933936 parse_flags |= PARSE_FLAG_LINEFEED; /* XXX: suppress that hack */
934937 redo:
935938 if (tok == '#') {
@@ -981,15 +984,12 @@ static int tcc_assemble_internal(TCCState *s1, int do_preprocess, int global) · 45 unmodified lines
981984 }
982985 }
983986 /* end of line */
984− if (tok != ';' && tok != TOK_LINEFEED){
987+ if (tok != ';' && tok != TOK_LINEFEED)
985988 expect("end of line");
986− }
987989 parse_flags &= ~PARSE_FLAG_LINEFEED; /* XXX: suppress that hack */
988− next();
989990 }
990991
991992 asm_free_labels(s1);
992−
993993 return 0;
994994 }
995995
@@ -1001,24 +1001,19 @@ ST_FUNC int tcc_assemble(TCCState *s1, int do_preprocess) · 5 unmodified lines
10011001
10021002 define_start = define_stack;
10031003 preprocess_start(s1);
1004+ tcc_debug_start(s1);
10041005
10051006 /* default section is text */
10061007 cur_text_section = text_section;
10071008 ind = cur_text_section->data_offset;
10081009 nocode_wanted = 0;
10091010
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−
10161011 ret = tcc_assemble_internal(s1, do_preprocess, 1);
10171012
10181013 cur_text_section->data_offset = ind;
10191014
1015+ tcc_debug_end(s1);
10201016 free_defines(define_start);
1021−
10221017 return ret;
10231018 }
10241019
tccgen.c+86−53
@@ -140,27 +140,9 @@ void pv (const char *lbl, int a, int b) · 139 unmodified lines
140140 #endif
141141
142142 /* ------------------------------------------------------------------------- */
143−ST_FUNC void tccgen_start(TCCState *s1)
143+/* start of translation unit info */
144+ST_FUNC void tcc_debug_start(TCCState *s1)
144145 {
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−
164146 if (s1->do_debug) {
165147 char buf[512];
166148
@@ -177,12 +159,91 @@ ST_FUNC void tccgen_start(TCCState *s1) · 10 unmodified lines
177159 text_section->data_offset, text_section, section_sym);
178160 put_stabs_r(file->filename, N_SO, 0, 0,
179161 text_section->data_offset, text_section, section_sym);
162+ last_ind = 0;
163+ last_line_num = 0;
180164 }
165+
181166 /* an elf symbol of type STT_FILE must be put so that STB_LOCAL
182167 symbols can be safely used */
183168 put_elf_sym(symtab_section, 0, 0,
184169 ELFW(ST_INFO)(STB_LOCAL, STT_FILE), 0,
185170 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);
186247
187248 #ifdef TCC_TARGET_ARM
188249 arm_init(s1);
@@ -194,10 +255,7 @@ ST_FUNC void tccgen_end(TCCState *s1) · 5 unmodified lines
194255 gen_inline_functions(s1);
195256 check_vstack();
196257 /* end of translation unit info */
197− if (s1->do_debug) {
198− put_stabs_r(NULL, N_SO, 0, 0,
199− text_section->data_offset, text_section, section_sym);
200− }
258+ tcc_debug_end(s1);
201259 }
202260
203261 /* ------------------------------------------------------------------------- */
@@ -5567,12 +5625,8 @@ static void block(int *bsym, int *csym, int is_expr) · 5363 unmodified lines
55675625 Sym *s;
55685626
55695627 /* generate line number info */
5570− if (tcc_state->do_debug &&
5571− (last_line_num != file->line_num || last_ind != ind)) {
5572− put_stabn(N_SLINE, 0, file->line_num, ind - func_ind);
5573− last_ind = ind;
5574− last_line_num = file->line_num;
5575− }
5628+ if (tcc_state->do_debug)
5629+ tcc_debug_line(tcc_state);
55765630
55775631 if (is_expr) {
55785632 /* default return value is (void) */
@@ -6741,22 +6795,6 @@ static void decl_initializer_alloc(CType *type, AttributeDef *ad, int r, · 1162 unmodified lines
67416795 }
67426796 }
67436797
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−
67606798 /* parse an old style function declaration list */
67616799 /* XXX: check multiple parameter */
67626800 static void func_decl_list(Sym *func_sym)
@@ -6820,15 +6858,12 @@ static void gen_function(Sym *sym) · 57 unmodified lines
68206858 vla_sp_loc = -1;
68216859 vla_sp_root_loc = -1;
68226860 /* put debug symbol */
6823− if (tcc_state->do_debug)
6824− put_func_debug(sym);
6825−
6861+ tcc_debug_funcstart(tcc_state, sym);
68266862 /* push a dummy symbol to enable local sym storage */
68276863 sym_push2(&local_stack, SYM_FIELD, 0, 0);
68286864 local_scope = 1; /* for function parameters */
68296865 gfunc_prolog(&sym->type);
68306866 local_scope = 0;
6831−
68326867 rsym = 0;
68336868 block(NULL, NULL, 0);
68346869 nocode_wanted = 0;
@@ -6847,9 +6882,7 @@ static void gen_function(Sym *sym) · 12 unmodified lines
68476882 if (sym->type.t & VT_WEAK)
68486883 weaken_symbol(sym);
68496884 apply_visibility(sym, &sym->type);
6850− if (tcc_state->do_debug) {
6851− put_stabn(N_FUN, 0, 0, ind - func_ind);
6852− }
6885+ tcc_debug_funcend(tcc_state, ind - func_ind);
68536886 /* It's better to crash than to generate wrong code */
68546887 cur_text_section = NULL;
68556888 funcname = ""; /* for safety */
tests/Makefile+2−2
@@ -36,13 +36,13 @@ endif · 35 unmodified lines
3636 ifeq ($(TARGETOS),Darwin)
3737 TESTS := $(filter-out hello-exe test3 $(BTESTS),$(TESTS))
3838 endif
39−ifeq (,$(filter arm64 i386 x86-64,$(ARCH)))
39+ifeq (,$(filter arm64 i386 x86_64,$(ARCH)))
4040 TESTS := $(filter-out vla_test-run,$(TESTS))
4141 endif
4242 ifeq ($(CONFIG_arm_eabi),yes)
4343 TESTS := $(filter-out test3,$(TESTS))
4444 endif
45−ifeq (,$(filter i386 x86-64,$(ARCH)))
45+ifeq (,$(filter i386 x86_64,$(ARCH)))
4646 TESTS := $(filter-out dlltest,$(TESTS))
4747 endif
4848
tests/tests2/Makefile+2−2
@@ -22,10 +22,10 @@ endif · 21 unmodified lines
2222 ifeq ($(TARGETOS),Darwin)
2323 SKIP += 40_stdio.test
2424 endif
25−ifeq ($(ARCH),x86-64)
25+ifeq ($(ARCH),x86_64)
2626 SKIP += 73_arm64.test
2727 endif
28−ifeq (,$(filter i386 x86-64,$(ARCH)))
28+ifeq (,$(filter i386 x86_64,$(ARCH)))
2929 SKIP += 85_asm-outside-function.test
3030 endif
3131
win32/Makefile+1−3
@@ -24,11 +24,9 @@ TARGET = $(CPU) · 23 unmodified lines
2424 ifeq ($(TARGET), 64)
2525 TFLAGS = -m$(TARGET) -DTCC_TARGET_X86_64
2626 TARCH = x86_64
27−CARCH = x86-64
2827 else
2928 TFLAGS = -m$(TARGET) -DTCC_TARGET_I386
3029 TARCH = i386
31−CARCH = i386
3230 endif
3331
3432 all: pre bootstrap libs rebuild
@@ -36,7 +34,7 @@ all: pre bootstrap libs rebuild · 1 unmodified line
3634 @ls -ls *.exe
3735
3836 pre:
39− @echo ARCH=$(CARCH) 1> ../config.mak
37+ @echo ARCH=$(TARCH) 1> ../config.mak
4038 @echo TARGETOS=Windows 1>> ../config.mak
4139 @echo CONFIG_WIN32=yes 1>> ../config.mak
4240 @echo TOPSRC=$$\(TOP\) 1>> ../config.mak
win32/include/_mingw.h+12−0
@@ -139,6 +139,18 @@ typedef struct localeinfo_struct _locale_tstruct,*_locale_t; · 138 unmodified lines
139139 #define NOSERVICE 1
140140 #define NOMCX 1
141141 #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
142154 #ifndef WINVER
143155 # define WINVER 0x0502
144156 #endif
win32/lib/crt1.c+4−1
@@ -73,15 +73,18 @@ int _runtmain(int argc, /* as tcc passed in */ char **argv) · 72 unmodified lines
7373 _startupinfo start_info = {0};
7474
7575 __tgetmainargs(&wargc, &wargv, &wenv, _dowildcard, &start_info);
76+ /* may be wrong when tcc has received wildcards (*.c) */
7677 if (argc < wargc)
7778 wargv += wargc - argc;
79+ else
80+ argc = wargc;
7881 #define argv wargv
7982 #endif
8083
8184 #ifdef __i386
8285 _controlfp(_PC_53, _MCW_PC);
8386 #endif
84− return _tmain(argc, argv, NULL);
87+ return _tmain(argc, argv, _tenviron);
8588 }
8689
8790 // =============================================
win32/lib/user32.def+4−0
@@ -336,6 +336,10 @@ GetWindow · 335 unmodified lines
336336 GetWindowContextHelpId
337337 GetWindowDC
338338 GetWindowInfo
339+GetWindowLongPtrA
340+GetWindowLongPtrW
341+SetWindowLongPtrA
342+SetWindowLongPtrW
339343 GetWindowLongA
340344 GetWindowLongW
341345 GetWindowModuleFileNameA
win32/lib/wincrt1.c+2−0
@@ -80,6 +80,8 @@ int _runtwinmain(int argc, /* as tcc passed in */ char **argv) · 79 unmodified lines
8080 __tgetmainargs(&wargc, &wargv, &wenv, 0, &start_info);
8181 if (argc < wargc)
8282 wargv += wargc - argc;
83+ else
84+ argc = wargc;
8385 #define argv wargv
8486 #endif
8587

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