1: The new patch for the other machines still have the problem.
2: libcrt Rename (what if gcc had libcrt as well)
3: parse_number exact problem
4: VT_VLS is to allow tcc
     Compile the following
     int b = 9;
     struct st {
     int a;
     int b [b]
     };
     struct st st1;
     st1.b [8] = 9;
     printf ("% d \ n", st1.b [8]);

     tcc a problem. Due to problems in front, and now can not be improved
5: they commit much, bug difficult to lock, you can not let other people help develop.
6: ('\ t') too

Thanks to Michael and Ray
Their criticism I have benefited!
This commit is contained in:
jiang
2014-05-04 13:18:31 +08:00
parent 089dea355a
commit 5e56fb635a
23 changed files with 1416 additions and 1814 deletions

View File

@ -1,5 +1,5 @@
#
# Tiny C Compiler Makefile for libcrt.a
# Tiny C Compiler Makefile for libtcc1.a
#
TOP = ..
@ -38,15 +38,15 @@ endif
DIR = $(TARGET)
native : ../libcrt.a
cross : $(DIR)/libcrt.a
native : ../libtcc1.a
cross : $(DIR)/libtcc1.a
native : TCC = $(TOP)/tcc$(EXESUF)
cross : TCC = $(TOP)/$(TARGET)-tcc$(EXESUF)
I386_O = libcrt.o alloca86.o alloca86-bt.o $(BCHECK_O)
X86_64_O = libcrt.o alloca86_64.o
ARM_O = libcrt.o armeabi.o alloca-arm.o
I386_O = libtcc1.o alloca86.o alloca86-bt.o $(BCHECK_O)
X86_64_O = libtcc1.o alloca86_64.o
ARM_O = libtcc1.o armeabi.o alloca-arm.o
WIN32_O = $(I386_O) crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o
WIN64_O = $(X86_64_O) crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o
@ -83,7 +83,7 @@ ifeq "$(TARGET)" "arm"
TGT = -DTCC_TARGET_ARM
XCC ?= $(TCC) -B$(TOP)
else
$(error libcrt.a not supported on target '$(TARGET)')
$(error libtcc1.a not supported on target '$(TARGET)')
endif
endif
endif
@ -102,7 +102,7 @@ ifdef XAR
AR = $(XAR)
endif
$(DIR)/libcrt.a ../libcrt.a : $(OBJ) $(XAR)
$(DIR)/libtcc1.a ../libtcc1.a : $(OBJ) $(XAR)
$(AR) rcs $@ $(OBJ)
$(DIR)/%.o : %.c
$(XCC) -c $< -o $@ $(XFLAGS)

View File

@ -533,24 +533,23 @@ unsigned long long __fixunssfdi (float a1)
register union float_long fl1;
register int exp;
register unsigned long l;
int s;
fl1.f = a1;
if (fl1.l == 0)
return 0;
return (0);
exp = EXP (fl1.l) - EXCESS - 24;
l = MANT(fl1.l);
s = SIGN(fl1.l)? -1: 1;
if (exp >= 64)
if (exp >= 41)
return (unsigned long long)-1;
else if (exp >= 0)
return ((unsigned long long)l << exp)*s;
return (unsigned long long)l << exp;
else if (exp >= -23)
return (l >> -exp)*s;
return l >> -exp;
else
return 0;
return 0;
}
unsigned long long __fixunsdfdi (double a1)
@ -558,7 +557,7 @@ unsigned long long __fixunsdfdi (double a1)
register union double_long dl1;
register int exp;
register unsigned long long l;
int s;
dl1.d = a1;
if (dl1.ll == 0)
@ -567,15 +566,15 @@ unsigned long long __fixunsdfdi (double a1)
exp = EXPD (dl1) - EXCESSD - 53;
l = MANTD_LL(dl1);
s = SIGND(dl1)? -1: 1;
if (exp >= 64)
if (exp >= 12)
return (unsigned long long)-1;
else if (exp >= 0)
return (l << exp)*s;
return l << exp;
else if (exp >= -52)
return (l >> -exp)*s;
return l >> -exp;
else
return 0;
return 0;
}
unsigned long long __fixunsxfdi (long double a1)
@ -583,24 +582,22 @@ unsigned long long __fixunsxfdi (long double a1)
register union ldouble_long dl1;
register int exp;
register unsigned long long l;
int s;
dl1.ld = a1;
if (dl1.l.lower == 0 && dl1.l.upper == 0)
return (0);
exp = EXPLD (dl1) - EXCESSLD - 64;
s = SIGNLD(dl1)? -1: 1;
l = dl1.l.lower;
if (exp >= 64)
if (exp > 0)
return (unsigned long long)-1;
else if (exp >= 0)
return ((unsigned long long)l << exp)*s;
else if (exp >= -64)
return (l >> -exp)*s;
else if (exp >= -63)
return l >> -exp;
else
return 0;
return 0;
}
long long __fixsfdi (float a1)
@ -640,7 +637,7 @@ extern void abort(void);
#endif
enum __va_arg_type {
__va_gen_reg, __va_float_reg, __va_ld_reg, __va_stack
__va_gen_reg, __va_float_reg, __va_stack
};
//This should be in sync with the declaration on our include/stdarg.h
@ -691,11 +688,10 @@ void *__va_arg(__va_list_struct *ap,
size = 8;
goto use_overflow_area;
case __va_ld_reg:
ap->overflow_arg_area = (char*)((intptr_t)(ap->overflow_arg_area + align - 1) & -(intptr_t)align);
case __va_stack:
use_overflow_area:
ap->overflow_arg_area += size;
ap->overflow_arg_area = (char*)((intptr_t)(ap->overflow_arg_area + align - 1) & -(intptr_t)align);
return ap->overflow_arg_area - size;
default: