From f2a1fca9e81b773927c0b28dffaa6e2ee8a5956a Mon Sep 17 00:00:00 2001
From: notaz <notasas@gmail.com>
Date: Tue, 12 Jan 2016 03:03:29 +0200
Subject: [PATCH] support ancient toolchains

---
 loader/Makefile   |  6 ++++--
 loader/syscalls.S | 10 ++++++++++
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/loader/Makefile b/loader/Makefile
index 85c25ba..e76d5df 100644
--- a/loader/Makefile
+++ b/loader/Makefile
@@ -17,10 +17,8 @@ ifeq "$(ARCH)" "ia32"
 ARCH = ia32
 CFLAGS += -m32
 LDFLAGS += -m32
-ASFLAGS += --32
 endif
 ifeq "$(ARCH)" "arm"
-ASFLAGS += -mfloat-abi=soft
 OBJ += syscalls.o emu_arm.o
 endif
 ifdef PND
@@ -55,6 +53,10 @@ $(TARGET_S): $(OBJ_S)
 $(TARGET_D): $(OBJ_D)
 	$(CC) -o $@ $^ -shared $(LDFLAGS)
 
+# easier to support old toolchains with this
+%.o: %.s
+	$(CC) -o $@ -c $< $(CFLAGS)
+
 clean:
 	$(RM) $(TARGET_S) $(TARGET_D) $(OBJ_S) $(OBJ_D)
 
diff --git a/loader/syscalls.S b/loader/syscalls.S
index ab5800b..6d48fbd 100644
--- a/loader/syscalls.S
+++ b/loader/syscalls.S
@@ -1,6 +1,16 @@
 @ vim:filetype=armasm
 #include <sys/syscall.h>
 
+@ support ancient toolchains (gcc 2.95.3 has upto 225)
+#ifndef __NR_futex
+#define __NR_futex			(__NR_SYSCALL_BASE+240)
+#endif
+#ifndef __NR_exit_group
+#define __NR_exit_group			(__NR_SYSCALL_BASE+248)
+#endif
+#ifndef __NR_clock_gettime
+#define __NR_clock_gettime		(__NR_SYSCALL_BASE+263)
+#endif
 
 .global sys_cacheflush @ const void *start_addr, const void *end_addr
 sys_cacheflush:
-- 
2.39.5