aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore5
-rw-r--r--Makefile4
-rwxr-xr-xconfigure2
-rw-r--r--tccrun.c16
-rw-r--r--tests/Makefile2
5 files changed, 24 insertions, 5 deletions
diff --git a/.gitignore b/.gitignore
index a845ddc..4985f6a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -38,3 +38,8 @@ config.mak
config.texi
tests
tags
+.DS_Store
+*.swp
+lib/x86_64
+tcc-doc.info
+conftest*
diff --git a/Makefile b/Makefile
index 43d7cfd..fd8602e 100644
--- a/Makefile
+++ b/Makefile
@@ -51,6 +51,10 @@ NATIVE_DEFINES+=$(if $(wildcard /lib/ld-linux.so.3),-DTCC_ARM_EABI)
NATIVE_DEFINES+=$(if $(shell grep -l "^Features.* \(vfp\|iwmmxt\) " /proc/cpuinfo),-DTCC_ARM_VFP)
endif
+ifeq ($(TARGETOS),Darwin)
+NATIVE_DEFINES+=-DWITHOUT_LIBTCC
+endif
+
ifdef CONFIG_WIN32
NATIVE_DEFINES+=-DTCC_TARGET_PE
endif
diff --git a/configure b/configure
index 3d68b1c..188c360 100755
--- a/configure
+++ b/configure
@@ -352,6 +352,7 @@ echo "Doc directory $docdir"
echo "Target root prefix $sysroot"
echo "Source path $source_path"
echo "C compiler $cc"
+echo "Target OS $targetos"
echo "CPU $cpu"
echo "Big Endian $bigendian"
echo "gprof enabled $gprof"
@@ -425,6 +426,7 @@ else
echo "Unsupported CPU"
exit 1
fi
+echo "TARGETOS=$targetos" >> config.mak
if test "$noldl" = "yes" ; then
echo "CONFIG_NOLDL=yes" >> config.mak
fi
diff --git a/tccrun.c b/tccrun.c
index 64a1dfd..de0ef89 100644
--- a/tccrun.c
+++ b/tccrun.c
@@ -461,7 +461,9 @@ static int rt_get_caller_pc(unsigned long *paddr, ucontext_t *uc, int level)
int i;
if (level == 0) {
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+#if defined(__APPLE__)
+ *paddr = uc->uc_mcontext->__ss.__eip;
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
*paddr = uc->uc_mcontext.mc_eip;
#elif defined(__dietlibc__)
*paddr = uc->uc_mcontext.eip;
@@ -470,7 +472,9 @@ static int rt_get_caller_pc(unsigned long *paddr, ucontext_t *uc, int level)
#endif
return 0;
} else {
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+#if defined(__APPLE__)
+ fp = uc->uc_mcontext->__ss.__ebp;
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
fp = uc->uc_mcontext.mc_ebp;
#elif defined(__dietlibc__)
fp = uc->uc_mcontext.ebp;
@@ -500,14 +504,18 @@ static int rt_get_caller_pc(unsigned long *paddr,
if (level == 0) {
/* XXX: only support linux */
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+#if defined(__APPLE__)
+ *paddr = uc->uc_mcontext->__ss.__rip;
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
*paddr = uc->uc_mcontext.mc_rip;
#else
*paddr = uc->uc_mcontext.gregs[REG_RIP];
#endif
return 0;
} else {
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+#if defined(__APPLE__)
+ fp = uc->uc_mcontext->__ss.__rbp;
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
fp = uc->uc_mcontext.mc_rbp;
#else
fp = uc->uc_mcontext.gregs[REG_RBP];
diff --git a/tests/Makefile b/tests/Makefile
index 8cd906d..2cf9e28 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -45,7 +45,7 @@ libtcc_test$(EXESUF): libtcc_test.c ../$(LIBTCC)
# test.ref - generate using gcc
# copy only tcclib.h so GCC's stddef and stdarg will be used
test.ref: tcctest.c
- cp -u ../include/tcclib.h .
+ cp ../include/tcclib.h .
$(CC) -o tcctest.gcc $< -I. -w $(CFLAGS) -std=gnu99
./tcctest.gcc > $@