aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog7
-rw-r--r--Makefile5
-rw-r--r--bcheck.c7
-rwxr-xr-xconfigure23
-rw-r--r--tcc.c14
5 files changed, 40 insertions, 16 deletions
diff --git a/Changelog b/Changelog
index 9cf673d..248423b 100644
--- a/Changelog
+++ b/Changelog
@@ -1,6 +1,11 @@
version 0.9.24:
-- Import 409,410: ARM EABI by Daniel Glöckner
+- Import changesets (part 4) 428,457,460,467: defines for openbsd etc.
+
+- Use _WIN32 for a windows hosted tcc and define it for the PE target,
+ otherwise define __unix / __linux (Detlef Riekenberg)
+
+- Import changesets (part 3) 409,410: ARM EABI by Daniel Glöckner
- Some in-between fixes:
TCC -E no longer hangs with macro calls involving newlines.
diff --git a/Makefile b/Makefile
index eda0889..502b0d4 100644
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,10 @@ include config.mak
CFLAGS+=-g -Wall
ifndef CONFIG_WIN32
-LIBS=-ldl
+LIBS=-lm
+ifndef CONFIG_NOLDL
+LIBS+=-ldl
+endif
BCHECK_O=bcheck.o
endif
CFLAGS_P=$(CFLAGS) -pg -static -DCONFIG_TCC_STATIC
diff --git a/bcheck.c b/bcheck.c
index d13abf5..0ec2a4b 100644
--- a/bcheck.c
+++ b/bcheck.c
@@ -21,7 +21,7 @@
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
-#ifndef __FreeBSD__
+#if !defined(__FreeBSD__) && !defined(__DragonFly__) && !defined(__OpenBSD__)
#include <malloc.h>
#endif
@@ -36,8 +36,9 @@
#define HAVE_MEMALIGN
-#if defined(__FreeBSD__) || defined(__dietlibc__)
-#warning Bound checking not fully supported on FreeBSD
+#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__dietlibc__) \
+ || defined(__UCLIBC__) || defined(__OpenBSD__)
+#warning Bound checking not fully supported in this environment.
#undef CONFIG_TCC_MALLOC_HOOKS
#undef HAVE_MEMALIGN
#endif
diff --git a/configure b/configure
index 4c9cf1e..56fe798 100755
--- a/configure
+++ b/configure
@@ -68,6 +68,12 @@ case $targetos in
MINGW32*)
mingw32="yes"
;;
+DragonFly)
+noldl="yes"
+;;
+OpenBSD)
+noldl="yes"
+;;
*) ;;
esac
@@ -142,15 +148,15 @@ if test -z "$cross_prefix" ; then
cat > $TMPC << EOF
#include <inttypes.h>
int main(int argc, char ** argv){
- volatile uint32_t i=0x01234567;
- return (*((uint8_t*)(&i))) == 0x67;
+ volatile uint32_t i=0x01234567;
+ return (*((uint8_t*)(&i))) == 0x67;
}
EOF
if $cc -o $TMPE $TMPC 2>/dev/null ; then
-$TMPE && bigendian="yes"
+ $TMPE && bigendian="yes"
else
-echo big/little test failed
+ echo big/little test failed
fi
else
@@ -302,6 +308,9 @@ else
echo "Unsupported CPU"
exit 1
fi
+if test "$noldl" = "yes" ; then
+ echo "CONFIG_NOLDL=yes" >> config.mak
+fi
if test "$mingw32" = "yes" ; then
echo "CONFIG_WIN32=yes" >> config.mak
echo "#define CONFIG_WIN32 1" >> $TMPH
@@ -327,7 +336,7 @@ if test "$source_path_used" = "yes" ; then
DIRS="tests"
FILES="Makefile tests/Makefile"
for dir in $DIRS ; do
- mkdir -p $dir
+ mkdir -p $dir
done
for f in $FILES ; do
ln -sf $source_path/$f $f
@@ -337,9 +346,9 @@ echo "SRC_PATH=$source_path" >> config.mak
diff $TMPH config.h >/dev/null 2>&1
if test $? -ne 0 ; then
- mv -f $TMPH config.h
+ mv -f $TMPH config.h
else
- echo "config.h is unchanged"
+ echo "config.h is unchanged"
fi
rm -f $TMPO $TMPC $TMPE $TMPS $TMPH
diff --git a/tcc.c b/tcc.c
index b364c2b..ce1a210 100644
--- a/tcc.c
+++ b/tcc.c
@@ -738,7 +738,8 @@ int __stdcall VirtualProtect(void*,unsigned long,unsigned long,unsigned long*);
#define strtof (float)strtod
#define strtoll (long long)strtol
#endif
-#elif defined(TCC_UCLIBC) || defined(__FreeBSD__)
+#elif defined(TCC_UCLIBC) || defined(__FreeBSD__) || defined(__DragonFly__) \
+ || defined(__OpenBSD__)
/* currently incorrect */
long double strtold(const char *nptr, char **endptr)
{
@@ -10013,9 +10014,15 @@ TCCState *tcc_new(void)
tcc_define_symbol(s, "arm", NULL);
tcc_define_symbol(s, "__APCS_32__", NULL);
#endif
-#if defined(linux)
+#ifdef TCC_TARGET_PE
+ tcc_define_symbol(s, "_WIN32", NULL);
+#else
+ tcc_define_symbol(s, "__unix__", NULL);
+ tcc_define_symbol(s, "__unix", NULL);
+#if defined(__linux)
tcc_define_symbol(s, "__linux__", NULL);
- tcc_define_symbol(s, "linux", NULL);
+ tcc_define_symbol(s, "__linux", NULL);
+#endif
#endif
/* tiny C specific defines */
tcc_define_symbol(s, "__TINYC__", NULL);
@@ -10025,7 +10032,6 @@ TCCState *tcc_new(void)
tcc_define_symbol(s, "__PTRDIFF_TYPE__", "int");
#ifdef TCC_TARGET_PE
tcc_define_symbol(s, "__WCHAR_TYPE__", "unsigned short");
- tcc_define_symbol(s, "_WIN32", NULL);
#else
tcc_define_symbol(s, "__WCHAR_TYPE__", "int");
#endif