Index: EcnlProtoTool/trunk/tcc-0.9.27/include/float.h
===================================================================
--- EcnlProtoTool/trunk/tcc-0.9.26/include/float.h	(revision 321)
+++ EcnlProtoTool/trunk/tcc-0.9.27/include/float.h	(revision 331)
@@ -28,5 +28,5 @@
 
 /* horrible intel long double */
-#ifdef __i386__
+#if defined __i386__ || defined __x86_64__
 
 #define LDBL_MANT_DIG 64
Index: EcnlProtoTool/trunk/tcc-0.9.27/include/stdarg.h
===================================================================
--- EcnlProtoTool/trunk/tcc-0.9.26/include/stdarg.h	(revision 321)
+++ EcnlProtoTool/trunk/tcc-0.9.27/include/stdarg.h	(revision 331)
@@ -5,24 +5,62 @@
 #ifndef _WIN64
 
-typedef void *va_list;
+//This should be in sync with the declaration on our lib/libtcc1.c
+/* GCC compatible definition of va_list. */
+typedef struct {
+    unsigned int gp_offset;
+    unsigned int fp_offset;
+    union {
+        unsigned int overflow_offset;
+        char *overflow_arg_area;
+    };
+    char *reg_save_area;
+} __va_list_struct;
 
-va_list __va_start(void *fp);
-void *__va_arg(va_list ap, int arg_type, int size);
-va_list __va_copy(va_list src);
-void __va_end(va_list ap);
+typedef __va_list_struct va_list[1];
 
-#define va_start(ap, last) ((ap) = __va_start(__builtin_frame_address(0)))
+void __va_start(__va_list_struct *ap, void *fp);
+void *__va_arg(__va_list_struct *ap, int arg_type, int size, int align);
+
+#define va_start(ap, last) __va_start(ap, __builtin_frame_address(0))
 #define va_arg(ap, type)                                                \
-    (*(type *)(__va_arg(ap, __builtin_va_arg_types(type), sizeof(type))))
-#define va_copy(dest, src) ((dest) = __va_copy(src))
-#define va_end(ap) __va_end(ap)
+    (*(type *)(__va_arg(ap, __builtin_va_arg_types(type), sizeof(type), __alignof__(type))))
+#define va_copy(dest, src) (*(dest) = *(src))
+#define va_end(ap)
+
+/* avoid conflicting definition for va_list on Macs. */
+#define _VA_LIST_T
 
 #else /* _WIN64 */
 typedef char *va_list;
-#define va_start(ap,last) ap = ((char *)&(last)) + ((sizeof(last)+7)&~7)
-#define va_arg(ap,type) (ap += (sizeof(type)+7)&~7, *(type *)(ap - ((sizeof(type)+7)&~7)))
+#define va_start(ap,last) __builtin_va_start(ap,last)
+#define va_arg(ap, t) ((sizeof(t) > 8 || (sizeof(t) & (sizeof(t) - 1))) \
+	? **(t **)((ap += 8) - 8) : *(t  *)((ap += 8) - 8))
+#define va_copy(dest, src) ((dest) = (src))
+#define va_end(ap)
+#endif
+
+#elif __arm__
+typedef char *va_list;
+#define _tcc_alignof(type) ((int)&((struct {char c;type x;} *)0)->x)
+#define _tcc_align(addr,type) (((unsigned)addr + _tcc_alignof(type) - 1) \
+                               & ~(_tcc_alignof(type) - 1))
+#define va_start(ap,last) ap = ((char *)&(last)) + ((sizeof(last)+3)&~3)
+#define va_arg(ap,type) (ap = (void *) ((_tcc_align(ap,type)+sizeof(type)+3) \
+                        &~3), *(type *)(ap - ((sizeof(type)+3)&~3)))
 #define va_copy(dest, src) (dest) = (src)
 #define va_end(ap)
-#endif
+
+#elif defined(__aarch64__)
+typedef struct {
+    void *__stack;
+    void *__gr_top;
+    void *__vr_top;
+    int   __gr_offs;
+    int   __vr_offs;
+} va_list;
+#define va_start(ap, last) __va_start(ap, last)
+#define va_arg(ap, type) __va_arg(ap, type)
+#define va_end(ap)
+#define va_copy(dest, src) ((dest) = (src))
 
 #else /* __i386__ */
Index: EcnlProtoTool/trunk/tcc-0.9.27/include/stdbool.h
===================================================================
--- EcnlProtoTool/trunk/tcc-0.9.26/include/stdbool.h	(revision 321)
+++ EcnlProtoTool/trunk/tcc-0.9.27/include/stdbool.h	(revision 331)
@@ -7,4 +7,5 @@
 #define true	1
 #define false	0
+#define __bool_true_false_are_defined 1
 
 #endif /* _STDBOOL_H */
Index: EcnlProtoTool/trunk/tcc-0.9.27/include/stddef.h
===================================================================
--- EcnlProtoTool/trunk/tcc-0.9.26/include/stddef.h	(revision 321)
+++ EcnlProtoTool/trunk/tcc-0.9.27/include/stddef.h	(revision 331)
@@ -14,12 +14,23 @@
 typedef signed short int int16_t;
 typedef signed int int32_t;
+#ifdef __LP64__
+typedef signed long int int64_t;
+#else
 typedef signed long long int int64_t;
+#endif
 typedef unsigned char uint8_t;
 typedef unsigned short int uint16_t;
 typedef unsigned int uint32_t;
+#ifdef __LP64__
+typedef unsigned long int uint64_t;
+#else
 typedef unsigned long long int uint64_t;
 #endif
+#endif
 
+#ifndef NULL
 #define NULL ((void*)0)
+#endif
+
 #define offsetof(type, field) ((size_t)&((type *)0)->field)
 
@@ -27,2 +38,17 @@
 
 #endif
+
+/* Older glibc require a wint_t from <stddef.h> (when requested
+   by __need_wint_t, as otherwise stddef.h isn't allowed to
+   define this type).   Note that this must be outside the normal
+   _STDDEF_H guard, so that it works even when we've included the file
+   already (without requiring wint_t).  Some other libs define _WINT_T
+   if they've already provided that type, so we can use that as guard.
+   TCC defines __WINT_TYPE__ for us.  */
+#if defined (__need_wint_t)
+#ifndef _WINT_T
+#define _WINT_T
+typedef __WINT_TYPE__ wint_t;
+#endif
+#undef __need_wint_t
+#endif
Index: EcnlProtoTool/trunk/tcc-0.9.27/include/tcclib.h
===================================================================
--- EcnlProtoTool/trunk/tcc-0.9.26/include/tcclib.h	(revision 321)
+++ 	(revision )
@@ -1,78 +1,0 @@
-/* Simple libc header for TCC 
- * 
- * Add any function you want from the libc there. This file is here
- * only for your convenience so that you do not need to put the whole
- * glibc include files on your floppy disk 
- */
-#ifndef _TCCLIB_H
-#define _TCCLIB_H
-
-#include <stddef.h>
-#include <stdarg.h>
-
-/* stdlib.h */
-void *calloc(size_t nmemb, size_t size);
-void *malloc(size_t size);
-void free(void *ptr);
-void *realloc(void *ptr, size_t size);
-int atoi(const char *nptr);
-long int strtol(const char *nptr, char **endptr, int base);
-unsigned long int strtoul(const char *nptr, char **endptr, int base);
-void exit(int);
-
-/* stdio.h */
-typedef struct __FILE FILE;
-#define EOF (-1)
-extern FILE *stdin;
-extern FILE *stdout;
-extern FILE *stderr;
-FILE *fopen(const char *path, const char *mode);
-FILE *fdopen(int fildes, const char *mode);
-FILE *freopen(const  char *path, const char *mode, FILE *stream);
-int fclose(FILE *stream);
-size_t  fread(void *ptr, size_t size, size_t nmemb, FILE *stream);
-size_t  fwrite(void *ptr, size_t size, size_t nmemb, FILE *stream);
-int fgetc(FILE *stream);
-char *fgets(char *s, int size, FILE *stream);
-int getc(FILE *stream);
-int getchar(void);
-char *gets(char *s);
-int ungetc(int c, FILE *stream);
-int fflush(FILE *stream);
-
-int printf(const char *format, ...);
-int fprintf(FILE *stream, const char *format, ...);
-int sprintf(char *str, const char *format, ...);
-int snprintf(char *str, size_t size, const  char  *format, ...);
-int asprintf(char **strp, const char *format, ...);
-int dprintf(int fd, const char *format, ...);
-int vprintf(const char *format, va_list ap);
-int vfprintf(FILE  *stream,  const  char *format, va_list ap);
-int vsprintf(char *str, const char *format, va_list ap);
-int vsnprintf(char *str, size_t size, const char  *format, va_list ap);
-int vasprintf(char  **strp,  const  char *format, va_list ap);
-int vdprintf(int fd, const char *format, va_list ap);
-
-void perror(const char *s);
-
-/* string.h */
-char *strcat(char *dest, const char *src);
-char *strchr(const char *s, int c);
-char *strrchr(const char *s, int c);
-char *strcpy(char *dest, const char *src);
-void *memcpy(void *dest, const void *src, size_t n);
-void *memmove(void *dest, const void *src, size_t n);
-void *memset(void *s, int c, size_t n);
-char *strdup(const char *s);
-
-/* dlfcn.h */
-#define RTLD_LAZY       0x001
-#define RTLD_NOW        0x002
-#define RTLD_GLOBAL     0x100
-
-void *dlopen(const char *filename, int flag);
-const char *dlerror(void);
-void *dlsym(void *handle, char *symbol);
-int dlclose(void *handle);
-
-#endif /* _TCCLIB_H */
