diff -aur tcc-0.9.20.orig/bcheck.c tcc-0.9.20/bcheck.c --- tcc-0.9.20.orig/bcheck.c 2003-10-05 12:23:48.000000000 +0200 +++ tcc-0.9.20/bcheck.c 2004-08-04 18:06:15.803828728 +0200 @@ -36,8 +36,8 @@ #define HAVE_MEMALIGN -#ifdef __FreeBSD__ -#warning Bound checking not fully supported on FreeBSD +#if defined(__FreeBSD__) || defined(__dietlibc__) +#warning Bound checking not fully supported on FreeBSD and dietlibc #undef CONFIG_TCC_MALLOC_HOOKS #undef HAVE_MEMALIGN #endif @@ -782,7 +782,7 @@ { void *ptr; size = size * nmemb; - ptr = __bound_malloc(size); + ptr = __bound_malloc(size, NULL); if (!ptr) return NULL; memset(ptr, 0, size); diff -aur tcc-0.9.20.orig/Makefile tcc-0.9.20/Makefile --- tcc-0.9.20.orig/Makefile 2003-10-05 12:23:48.000000000 +0200 +++ tcc-0.9.20/Makefile 2004-08-04 18:09:15.639489552 +0200 @@ -4,7 +4,7 @@ include config.mak CFLAGS=-O2 -g -Wall -LIBS=-ldl +LIBS=-ldl -lm CFLAGS_P=$(CFLAGS) -pg -static -DCONFIG_TCC_STATIC LIBS_P= @@ -21,7 +21,7 @@ # run local version of tcc with local libraries and includes TCC=./tcc -B. -I. -all: tcc libtcc1.a bcheck.o tcc-doc.html tcc.1 libtcc.a libtcc_test +all: tcc libtcc1.a bcheck.o tcc.1 libtcc.a libtcc_test Makefile: config.mak @@ -167,7 +167,7 @@ $(AR) rcs $@ $^ libtcc_test: libtcc_test.c libtcc.a - $(CC) $(CFLAGS) -I. -o $@ $< -L. -ltcc -ldl + $(CC) $(CFLAGS) -I. -o $@ $< -L. -ltcc $(LIBS) libtest: libtcc_test ./libtcc_test diff -aur tcc-0.9.20.orig/stddef.h tcc-0.9.20/stddef.h --- tcc-0.9.20.orig/stddef.h 2003-10-05 12:23:48.000000000 +0200 +++ tcc-0.9.20/stddef.h 2004-08-04 18:07:15.828703560 +0200 @@ -7,12 +7,14 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t; #define offsetof(type, field) ((size_t) &((type *)0)->field) +#ifndef __dietlibc__ /* need to do that because of glibc 2.1 bug (should have a way to test presence of 'long long' without __GNUC__, or TCC should define __GNUC__ ? */ #ifndef __int8_t_defined #define __int8_t_defined typedef char int8_t; +#endif typedef short int int16_t; typedef int int32_t; typedef long long int int64_t; diff -aur tcc-0.9.20.orig/tcc.c tcc-0.9.20/tcc.c --- tcc-0.9.20.orig/tcc.c 2003-10-05 12:23:48.000000000 +0200 +++ tcc-0.9.20/tcc.c 2004-08-04 18:01:27.859602904 +0200 @@ -8992,6 +8992,8 @@ if (level == 0) { #ifdef __FreeBSD__ *paddr = uc->uc_mcontext.mc_eip; +#elif __dietlibc__ + *paddr = uc->uc_mcontext.eip; #else *paddr = uc->uc_mcontext.gregs[REG_EIP]; #endif @@ -8999,6 +9001,8 @@ } else { #ifdef __FreeBSD__ fp = uc->uc_mcontext.mc_ebp; +#elif __dietlibc__ + fp = uc->uc_mcontext.ebp; #else fp = uc->uc_mcontext.gregs[REG_EBP]; #endif