History

Import more changesets from Rob Landley's fork (part 2)

grischka committed 18 years ago

Commit d778bde1 parent 54bf8c010 files · +157 −79Browse files

Unified · Split

10 files
  1. Changelog +16 −0
  2. Makefile +10 −3
  3. stddef.h +8 −3
  4. tcc.c +92 −67
  5. tccasm.c +1 −1
  6. tccelf.c +18 −1
  7. tcctok.h +1 −1
  8. win32/include/_mingw.h +2 −0
  9. win32/include/stdarg.h +1 −0
  10. win32/include/stddef.h +8 −3
Changelog+16−0
@@ -1,5 +1,21 @@
11 version 0.9.24:
22
3+- Import more changesets from Rob Landley's fork (part 2):
4+ 487: Handle long long constants in gen_opic() (Rob Landley)
5+ 484: Handle parentheses within __attribute__((...)) (Rob Landley)
6+ 480: Remove a goto in decl_initializer_alloc (Rob Landley)
7+ 475: Fix dereferences in inline assembly output (Joshua Phillips)
8+ 474: Cast ptrs to ints of different sizes correctly (Joshua Phillips)
9+ 473: Fix size of structs with empty array member (Joshua Phillips)
10+ 470: No warning for && and || with mixed pointers/integers (Rob Landley)
11+ 469: Fix symbol visibility problems in the linker (Vincent Pit)
12+ 468: Allow && and || involving pointer arguments (Rob Landley)
13+ 455: Optimize case labels with no code in between (Zdenek Pavlas)
14+ 450: Implement alloca for x86 (grischka)
15+ 415: Parse unicode escape sequences (Axel Liljencrantz)
16+ 407: Add a simple va_copy() in stdarg.h (Hasso Tepper)
17+ 400: Allow typedef names as symbols (Dave Dodge)
18+
319 - Import some changesets from Rob Landley's fork (part 1):
420 462: Use LGPL with bcheck.c and il-gen.c
521 458: Fix global compound literals (in unary: case '&':) (Andrew Johnson)
Makefile+10−3
@@ -176,6 +176,9 @@ else · 175 unmodified lines
176176 LIBTCC1_OBJS=libtcc1.o
177177 LIBTCC1_CC=$(CC)
178178 endif
179+ifeq ($(ARCH),i386)
180+LIBTCC1_OBJS+=alloca86.o alloca86-bt.o
181+endif
179182
180183 %.o: %.c
181184 $(LIBTCC1_CC) -O2 -Wall -c -o $@ $<
@@ -237,7 +240,11 @@ libinstall: libtcc.a · 55 unmodified lines
237240 $(INSTALL) -m644 libtcc.h "$(includedir)"
238241
239242 libtcc.o: tcc.c i386-gen.c Makefile
243+ifdef CONFIG_WIN32
244+ $(CC) $(CFLAGS) -DTCC_TARGET_PE -DLIBTCC -c -o $@ $<
245+else
240246 $(CC) $(CFLAGS) -DLIBTCC -c -o $@ $<
247+endif
241248
242249 libtcc.a: libtcc.o
243250 $(AR) rcs $@ $^
@@ -282,11 +289,11 @@ cache: tcc_g · 38 unmodified lines
282289
283290 # documentation and man page
284291 tcc-doc.html: tcc-doc.texi
285− texi2html -monolithic -number $<
292+ -texi2html -monolithic -number $<
286293
287294 tcc.1: tcc-doc.texi
288− ./texi2pod.pl $< tcc.pod
289− pod2man --section=1 --center=" " --release=" " tcc.pod > $@
295+ -./texi2pod.pl $< tcc.pod
296+ -pod2man --section=1 --center=" " --release=" " tcc.pod > $@
290297
291298 FILE=tcc-$(shell cat VERSION)
292299
stddef.h+8−3
@@ -12,10 +12,15 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t; · 11 unmodified lines
1212 __GNUC__ ? */
1313 #if !defined(__int8_t_defined) && !defined(__dietlibc__)
1414 #define __int8_t_defined
15−typedef char int8_t;
16−typedef short int int16_t;
17−typedef int int32_t;
15+typedef char int8_t;
16+typedef short int int16_t;
17+typedef int int32_t;
1818 typedef long long int int64_t;
1919 #endif
2020
21+#ifdef __i386__
22+void *_alloca(size_t);
23+#define alloca _alloca
24+#endif
25+
2126 #endif
tcc.c+92−67
@@ -1290,6 +1290,7 @@ static void put_extern_sym2(Sym *sym, Section *section, · 1289 unmodified lines
12901290 case TOK_memset:
12911291 case TOK_strlen:
12921292 case TOK_strcpy:
1293+ case TOK__alloca:
12931294 strcpy(buf, "__bound_");
12941295 strcat(buf, name);
12951296 name = buf;
@@ -3123,6 +3124,8 @@ static void parse_escape_string(CString *outstr, const uint8_t *buf, int is_long · 1827 unmodified lines
31233124 c = n;
31243125 goto add_char_nonext;
31253126 case 'x':
3127+ case 'u':
3128+ case 'U':
31263129 p++;
31273130 n = 0;
31283131 for(;;) {
@@ -4360,7 +4363,7 @@ static void macro_subst(TokenString *tok_str, Sym **nested_list, · 1231 unmodified lines
43604363 ptr = (int *)macro_ptr;
43614364 macro_ptr = ml.p;
43624365 if (can_read_stream && *can_read_stream == &ml)
4363− *can_read_stream = ml.prev;
4366+ *can_read_stream = ml.prev;
43644367 if (ret != 0)
43654368 goto no_subst;
43664369 } else {
@@ -5298,8 +5301,8 @@ void gen_opl(int op) · 931 unmodified lines
52985301 #if defined(TCC_TARGET_I386)
52995302 b = psym(0x850f, 0);
53005303 #elif defined(TCC_TARGET_ARM)
5301− b = ind;
5302− o(0x1A000000 | encbranch(ind, 0, 1));
5304+ b = ind;
5305+ o(0x1A000000 | encbranch(ind, 0, 1));
53035306 #elif defined(TCC_TARGET_C67)
53045307 error("not implemented");
53055308 #else
@@ -5329,23 +5332,29 @@ void gen_opl(int op) · 23 unmodified lines
53295332 independent opt */
53305333 void gen_opic(int op)
53315334 {
5332− int fc, c1, c2, n;
5335+ int c1, c2, t1, t2, n, c;
53335336 SValue *v1, *v2;
5337+ long long l1, l2, l;
5338+ typedef unsigned long long U;
53345339
53355340 v1 = vtop - 1;
53365341 v2 = vtop;
5342+ t1 = v1->type.t & VT_BTYPE;
5343+ t2 = v2->type.t & VT_BTYPE;
5344+ l1 = (t1 == VT_LLONG) ? v1->c.ll : v1->c.i;
5345+ l2 = (t2 == VT_LLONG) ? v2->c.ll : v2->c.i;
5346+
53375347 /* currently, we cannot do computations with forward symbols */
53385348 c1 = (v1->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST;
53395349 c2 = (v2->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST;
53405350 if (c1 && c2) {
5341− fc = v2->c.i;
53425351 switch(op) {
5343− case '+': v1->c.i += fc; break;
5344− case '-': v1->c.i -= fc; break;
5345− case '&': v1->c.i &= fc; break;
5346− case '^': v1->c.i ^= fc; break;
5347− case '|': v1->c.i |= fc; break;
5348− case '*': v1->c.i *= fc; break;
5352+ case '+': l1 += l2; break;
5353+ case '-': l1 -= l2; break;
5354+ case '&': l1 &= l2; break;
5355+ case '^': l1 ^= l2; break;
5356+ case '|': l1 |= l2; break;
5357+ case '*': l1 *= l2; break;
53495358
53505359 case TOK_PDIV:
53515360 case '/':
@@ -5353,66 +5362,68 @@ void gen_opic(int op) · 1 unmodified line
53535362 case TOK_UDIV:
53545363 case TOK_UMOD:
53555364 /* if division by zero, generate explicit division */
5356− if (fc == 0) {
5365+ if (l2 == 0) {
53575366 if (const_wanted)
53585367 error("division by zero in constant");
53595368 goto general_case;
53605369 }
53615370 switch(op) {
5362− default: v1->c.i /= fc; break;
5363− case '%': v1->c.i %= fc; break;
5364− case TOK_UDIV: v1->c.i = (unsigned)v1->c.i / fc; break;
5365− case TOK_UMOD: v1->c.i = (unsigned)v1->c.i % fc; break;
5371+ default: l1 /= l2; break;
5372+ case '%': l1 %= l2; break;
5373+ case TOK_UDIV: l1 = (U)l1 / l2; break;
5374+ case TOK_UMOD: l1 = (U)l1 % l2; break;
53665375 }
53675376 break;
5368− case TOK_SHL: v1->c.i <<= fc; break;
5369− case TOK_SHR: v1->c.i = (unsigned)v1->c.i >> fc; break;
5370− case TOK_SAR: v1->c.i >>= fc; break;
5377+ case TOK_SHL: l1 <<= l2; break;
5378+ case TOK_SHR: l1 = (U)l1 >> l2; break;
5379+ case TOK_SAR: l1 >>= l2; break;
53715380 /* tests */
5372− case TOK_ULT: v1->c.i = (unsigned)v1->c.i < (unsigned)fc; break;
5373− case TOK_UGE: v1->c.i = (unsigned)v1->c.i >= (unsigned)fc; break;
5374− case TOK_EQ: v1->c.i = v1->c.i == fc; break;
5375− case TOK_NE: v1->c.i = v1->c.i != fc; break;
5376− case TOK_ULE: v1->c.i = (unsigned)v1->c.i <= (unsigned)fc; break;
5377− case TOK_UGT: v1->c.i = (unsigned)v1->c.i > (unsigned)fc; break;
5378− case TOK_LT: v1->c.i = v1->c.i < fc; break;
5379− case TOK_GE: v1->c.i = v1->c.i >= fc; break;
5380− case TOK_LE: v1->c.i = v1->c.i <= fc; break;
5381− case TOK_GT: v1->c.i = v1->c.i > fc; break;
5381+ case TOK_ULT: l1 = (U)l1 < (U)l2; break;
5382+ case TOK_UGE: l1 = (U)l1 >= (U)l2; break;
5383+ case TOK_EQ: l1 = l1 == l2; break;
5384+ case TOK_NE: l1 = l1 != l2; break;
5385+ case TOK_ULE: l1 = (U)l1 <= (U)l2; break;
5386+ case TOK_UGT: l1 = (U)l1 > (U)l2; break;
5387+ case TOK_LT: l1 = l1 < l2; break;
5388+ case TOK_GE: l1 = l1 >= l2; break;
5389+ case TOK_LE: l1 = l1 <= l2; break;
5390+ case TOK_GT: l1 = l1 > l2; break;
53825391 /* logical */
5383− case TOK_LAND: v1->c.i = v1->c.i && fc; break;
5384− case TOK_LOR: v1->c.i = v1->c.i || fc; break;
5392+ case TOK_LAND: l1 = l1 && l2; break;
5393+ case TOK_LOR: l1 = l1 || l2; break;
53855394 default:
53865395 goto general_case;
53875396 }
5397+ v1->c.ll = l1;
53885398 vtop--;
53895399 } else {
53905400 /* if commutative ops, put c2 as constant */
53915401 if (c1 && (op == '+' || op == '&' || op == '^' ||
53925402 op == '|' || op == '*')) {
53935403 vswap();
5394− swap(&c1, &c2);
5404+ c = c1, c1 = c2, c2 = c;
5405+ l = l1, l1 = l2, l2 = l;
53955406 }
5396− fc = vtop->c.i;
5407+ /* Filter out NOP operations like x*1, x-0, x&-1... */
53975408 if (c2 && (((op == '*' || op == '/' || op == TOK_UDIV ||
53985409 op == TOK_PDIV) &&
5399− fc == 1) ||
5410+ l2 == 1) ||
54005411 ((op == '+' || op == '-' || op == '|' || op == '^' ||
54015412 op == TOK_SHL || op == TOK_SHR || op == TOK_SAR) &&
5402− fc == 0) ||
5413+ l2 == 0) ||
54035414 (op == '&' &&
5404− fc == -1))) {
5415+ l2 == -1))) {
54055416 /* nothing to do */
54065417 vtop--;
54075418 } else if (c2 && (op == '*' || op == TOK_PDIV || op == TOK_UDIV)) {
54085419 /* try to use shifts instead of muls or divs */
5409− if (fc > 0 && (fc & (fc - 1)) == 0) {
5420+ if (l2 > 0 && (l2 & (l2 - 1)) == 0) {
54105421 n = -1;
5411− while (fc) {
5412− fc >>= 1;
5422+ while (l2) {
5423+ l2 >>= 1;
54135424 n++;
54145425 }
5415− vtop->c.i = n;
5426+ vtop->c.ll = n;
54165427 if (op == '*')
54175428 op = TOK_SHL;
54185429 else if (op == TOK_PDIV)
@@ -5426,14 +5437,17 @@ void gen_opic(int op) · 7 unmodified lines
54265437 (VT_CONST | VT_SYM)) {
54275438 /* symbol + constant case */
54285439 if (op == '-')
5429− fc = -fc;
5440+ l2 = -l2;
54305441 vtop--;
5431− vtop->c.i += fc;
5442+ vtop->c.ll += l2;
54325443 } else {
54335444 general_case:
54345445 if (!nocode_wanted) {
54355446 /* call low level op generator */
5436− gen_opi(op);
5447+ if (t1 == VT_LLONG || t2 == VT_LLONG)
5448+ gen_opl(op);
5449+ else
5450+ gen_opi(op);
54375451 } else {
54385452 vtop--;
54395453 }
@@ -5540,7 +5554,8 @@ static void check_comparison_pointer_types(SValue *p1, SValue *p2, int op) · 100 unmodified lines
55405554 bt2 = type2->t & VT_BTYPE;
55415555 /* accept comparison between pointer and integer with a warning */
55425556 if ((is_integer_btype(bt1) || is_integer_btype(bt2)) && op != '-') {
5543− warning("comparison between pointer and integer");
5557+ if (op != TOK_LOR && op != TOK_LAND )
5558+ warning("comparison between pointer and integer");
55445559 return;
55455560 }
55465561
@@ -5586,7 +5601,7 @@ void gen_op(int op) · 39 unmodified lines
55865601 if (bt1 == VT_PTR || bt2 == VT_PTR) {
55875602 /* at least one operand is a pointer */
55885603 /* relationnal op: must be both pointers */
5589− if (op >= TOK_ULT && op <= TOK_GT) {
5604+ if (op >= TOK_ULT && op <= TOK_LOR) {
55905605 check_comparison_pointer_types(vtop - 1, vtop, op);
55915606 /* pointers are handled are unsigned */
55925607 t = VT_INT | VT_UNSIGNED;
@@ -5696,8 +5711,6 @@ void gen_op(int op) · 103 unmodified lines
56965711 gen_cast(&type1);
56975712 if (is_float(t))
56985713 gen_opif(op);
5699− else if ((t & VT_BTYPE) == VT_LLONG)
5700− gen_opl(op);
57015714 else
57025715 gen_opic(op);
57035716 if (op >= TOK_ULT && op <= TOK_GT) {
@@ -5947,6 +5960,11 @@ static void gen_cast(CType *type) · 243 unmodified lines
59475960 the lvalue already contains the real type size (see
59485961 VT_LVAL_xxx constants) */
59495962 }
5963+ } else if ((dbt & VT_BTYPE) == VT_PTR && !(vtop->r & VT_LVAL)) {
5964+ /* if we are casting between pointer types,
5965+ we must update the VT_LVAL_xxx size */
5966+ vtop->r = (vtop->r & ~VT_LVAL_TYPE)
5967+ | (lvalue_type(type->ref->type.t) & VT_LVAL_TYPE);
59505968 }
59515969 vtop->type = *type;
59525970 }
@@ -6502,12 +6520,15 @@ static void parse_attribute(AttributeDef *ad) · 549 unmodified lines
65026520 if (tcc_state->warn_unsupported)
65036521 warning("'%s' attribute ignored", get_tok_str(t, NULL));
65046522 /* skip parameters */
6505− /* XXX: skip parenthesis too */
65066523 if (tok == '(') {
6507− next();
6508− while (tok != ')' && tok != -1)
6524+ int parenthesis = 0;
6525+ do {
6526+ if (tok == '(')
6527+ parenthesis++;
6528+ else if (tok == ')')
6529+ parenthesis--;
65096530 next();
6510− next();
6531+ } while (parenthesis && tok != -1);
65116532 }
65126533 break;
65136534 }
@@ -6668,7 +6689,8 @@ static void struct_decl(CType *type, int u) · 154 unmodified lines
66686689 if (a == TOK_STRUCT) {
66696690 c = (c + align - 1) & -align;
66706691 offset = c;
6671− c += size;
6692+ if (size > 0)
6693+ c += size;
66726694 } else {
66736695 offset = 0;
66746696 if (size > c)
@@ -6719,13 +6741,14 @@ static void struct_decl(CType *type, int u) · 44 unmodified lines
67196741 */
67206742 static int parse_btype(CType *type, AttributeDef *ad)
67216743 {
6722− int t, u, type_found, typespec_found;
6744+ int t, u, type_found, typespec_found, typedef_found;
67236745 Sym *s;
67246746 CType type1;
67256747
67266748 memset(ad, 0, sizeof(AttributeDef));
67276749 type_found = 0;
67286750 typespec_found = 0;
6751+ typedef_found = 0;
67296752 t = 0;
67306753 while(1) {
67316754 switch(tok) {
@@ -6809,9 +6832,9 @@ static int parse_btype(CType *type, AttributeDef *ad) · 77 unmodified lines
68096832 case TOK_SIGNED2:
68106833 case TOK_SIGNED3:
68116834 typespec_found = 1;
6812− t |= VT_SIGNED;
6813− next();
6814− break;
6835+ t |= VT_SIGNED;
6836+ next();
6837+ break;
68156838 case TOK_REGISTER:
68166839 case TOK_AUTO:
68176840 case TOK_RESTRICT1:
@@ -6858,11 +6881,12 @@ static int parse_btype(CType *type, AttributeDef *ad) · 40 unmodified lines
68586881 parse_expr_type(&type1);
68596882 goto basic_type2;
68606883 default:
6861− if (typespec_found)
6884+ if (typespec_found || typedef_found)
68626885 goto the_end;
68636886 s = sym_find(tok);
68646887 if (!s || !(s->type.t & VT_TYPEDEF))
68656888 goto the_end;
6889+ typedef_found = 1;
68666890 t |= (s->type.t & ~VT_TYPEDEF);
68676891 type->ref = s->type.ref;
68686892 next();
@@ -8164,6 +8188,9 @@ static void block(int *bsym, int *csym, int *case_sym, int *def_sym, · 1295 unmodified lines
81648188 int v1, v2;
81658189 if (!case_sym)
81668190 expect("switch");
8191+ /* since a case is like a label, we must skip it with a jmp */
8192+ b = gjmp(0);
8193+ next_case:
81678194 next();
81688195 v1 = expr_const();
81698196 v2 = v1;
@@ -8173,24 +8200,26 @@ static void block(int *bsym, int *csym, int *case_sym, int *def_sym, · 3 unmodified lines
81738200 if (v2 < v1)
81748201 warning("empty case range");
81758202 }
8176− /* since a case is like a label, we must skip it with a jmp */
8177− b = gjmp(0);
81788203 gsym(*case_sym);
81798204 vseti(case_reg, 0);
81808205 vpushi(v1);
81818206 if (v1 == v2) {
81828207 gen_op(TOK_EQ);
8183− *case_sym = gtst(1, 0);
8208+ *case_sym = 0;
81848209 } else {
81858210 gen_op(TOK_GE);
81868211 *case_sym = gtst(1, 0);
81878212 vseti(case_reg, 0);
81888213 vpushi(v2);
81898214 gen_op(TOK_LE);
8190− *case_sym = gtst(1, *case_sym);
81918215 }
8192− gsym(b);
81938216 skip(':');
8217+ if (tok == TOK_CASE) {
8218+ b = gtst(0, b);
8219+ goto next_case;
8220+ }
8221+ *case_sym = gtst(1, *case_sym);
8222+ gsym(b);
81948223 is_expr = 0;
81958224 goto block_after_label;
81968225 } else
@@ -8873,11 +8902,7 @@ static void decl_initializer_alloc(CType *type, AttributeDef *ad, int r, · 676 unmodified lines
88738902 }
88748903
88758904 if (v) {
8876− if (scope == VT_CONST) {
8877− if (!sym)
8878− goto do_def;
8879− } else {
8880− do_def:
8905+ if (scope != VT_CONST || !sym) {
88818906 sym = sym_push(v, type, r | VT_SYM, 0);
88828907 }
88838908 /* update symbol definition */
tccasm.c+1−1
@@ -806,7 +806,7 @@ static void subst_asm_operands(ASMOperand *operands, int nb_operands, · 805 unmodified lines
806806 sv = *op->vt;
807807 if (op->reg >= 0) {
808808 sv.r = op->reg;
809− if ((op->vt->r & VT_VALMASK) == VT_LLOCAL)
809+ if ((op->vt->r & VT_VALMASK) == VT_LLOCAL && op->is_memory)
810810 sv.r |= VT_LVAL;
811811 }
812812 subst_asm_operand(out_str, &sv, modifier);
tccelf.c+18−1
@@ -182,9 +182,11 @@ static int add_elf_sym(Section *s, unsigned long value, unsigned long size, · 181 unmodified lines
182182 {
183183 Elf32_Sym *esym;
184184 int sym_bind, sym_index, sym_type, esym_bind;
185+ unsigned char sym_vis, esym_vis, new_vis;
185186
186187 sym_bind = ELF32_ST_BIND(info);
187188 sym_type = ELF32_ST_TYPE(info);
189+ sym_vis = ELF32_ST_VISIBILITY(other);
188190
189191 if (sym_bind != STB_LOCAL) {
190192 /* we search global or weak symbols */
@@ -194,6 +196,19 @@ static int add_elf_sym(Section *s, unsigned long value, unsigned long size, · 3 unmodified lines
194196 esym = &((Elf32_Sym *)s->data)[sym_index];
195197 if (esym->st_shndx != SHN_UNDEF) {
196198 esym_bind = ELF32_ST_BIND(esym->st_info);
199+ /* propagate the most constraining visibility */
200+ /* STV_DEFAULT(0)<STV_PROTECTED(3)<STV_HIDDEN(2)<STV_INTERNAL(1) */
201+ esym_vis = ELF32_ST_VISIBILITY(esym->st_other);
202+ if (esym_vis == STV_DEFAULT) {
203+ new_vis = sym_vis;
204+ } else if (sym_vis == STV_DEFAULT) {
205+ new_vis = esym_vis;
206+ } else {
207+ new_vis = (esym_vis < sym_vis) ? esym_vis : sym_vis;
208+ }
209+ esym->st_other = (esym->st_other & ~ELF32_ST_VISIBILITY(-1))
210+ | new_vis;
211+ other = esym->st_other; /* in case we have to patch esym */
197212 if (sh_num == SHN_UNDEF) {
198213 /* ignore adding of undefined symbol if the
199214 corresponding symbol is already defined */
@@ -202,6 +217,8 @@ static int add_elf_sym(Section *s, unsigned long value, unsigned long size, · 2 unmodified lines
202217 goto do_patch;
203218 } else if (sym_bind == STB_WEAK && esym_bind == STB_GLOBAL) {
204219 /* weak is ignored if already global */
220+ } else if (sym_vis == STV_HIDDEN || sym_vis == STV_INTERNAL) {
221+ /* ignore hidden symbols after */
205222 } else {
206223 #if 0
207224 printf("new_bind=%d new_shndx=%d last_bind=%d old_shndx=%d\n",
@@ -1949,7 +1966,7 @@ static int tcc_load_object_file(TCCState *s1, · 1741 unmodified lines
19491966 if (sym_index >= nb_syms)
19501967 goto invalid_reloc;
19511968 sym_index = old_to_new_syms[sym_index];
1952− /* ignore link_once in rel section. */
1969+ /* ignore link_once in rel section. */
19531970 if (!sym_index && !sm->link_once) {
19541971 invalid_reloc:
19551972 error_noabort("Invalid relocation entry [%2d] '%s' @ %.8x",
tcctok.h+1−1
@@ -123,7 +123,6 @@ · 122 unmodified lines
123123 /* builtin functions or variables */
124124 DEF(TOK_memcpy, "memcpy")
125125 DEF(TOK_memset, "memset")
126− DEF(TOK_alloca, "alloca")
127126 DEF(TOK___divdi3, "__divdi3")
128127 DEF(TOK___moddi3, "__moddi3")
129128 DEF(TOK___udivdi3, "__udivdi3")
@@ -188,6 +187,7 @@ · 58 unmodified lines
188187 DEF(TOK_memmove, "memmove")
189188 DEF(TOK_strlen, "strlen")
190189 DEF(TOK_strcpy, "strcpy")
190+ DEF(TOK__alloca, "_alloca")
191191 #endif
192192
193193 /* Tiny Assembler */
win32/include/_mingw.h+2−0
@@ -18,6 +18,8 @@ · 17 unmodified lines
1818 #ifndef __MINGW_H
1919 #define __MINGW_H
2020
21+#include <stddef.h>
22+
2123 #define __int64 long long
2224 #define __int32 long
2325 #define __int16 short
win32/include/stdarg.h+1−0
@@ -6,6 +6,7 @@ typedef char *va_list; · 5 unmodified lines
66 /* only correct for i386 */
77 #define va_start(ap,last) ap = ((char *)&(last)) + ((sizeof(last)+3)&~3)
88 #define va_arg(ap,type) (ap += (sizeof(type)+3)&~3, *(type *)(ap - ((sizeof(type)+3)&~3)))
9+#define va_copy(dest, src) (dest) = (src)
910 #define va_end(ap)
1011
1112 /* fix a buggy dependency on GCC in libio.h */
win32/include/stddef.h+8−3
@@ -12,10 +12,15 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t; · 11 unmodified lines
1212 __GNUC__ ? */
1313 #if !defined(__int8_t_defined) && !defined(__dietlibc__)
1414 #define __int8_t_defined
15−typedef char int8_t;
16−typedef short int int16_t;
17−typedef int int32_t;
15+typedef char int8_t;
16+typedef short int int16_t;
17+typedef int int32_t;
1818 typedef long long int int64_t;
1919 #endif
2020
21+#ifdef __i386__
22+void *_alloca(size_t);
23+#define alloca _alloca
24+#endif
25+
2126 #endif