Commit Diff


commit - 3528385d9abd041019a7c8986562d60124b69b6f
commit + ced16aa55e52023a094d3d6a2e81fea56f8581ca
blob - f2274af0927a0ca27546fc37257d52fd72a17993
blob + 4b63d49e1e5befeeb826ae9072beb5b17c037060
--- Makefile
+++ Makefile
@@ -1,4 +1,3 @@
-.POSIX:
 .SUFFIXES:
 .SUFFIXES: .c .S .o .elf
 
@@ -55,7 +54,7 @@ src/syscalls.h: src/syscalls.inc
 	sed 's/^\.set \(SYS_[a-z0-9_]*\), \([0-9]*\)$$/#define \1 \2/'	\
 		< src/syscalls.inc > $@
 
-.c.o: src/rvemu.h
+.c.o:
 	${CC} -c -o $@ $< ${CFLAGS}
 
 
blob - /dev/null
blob + c2e88fc98c8d41aa6cf7e3af71e768dcf47380bc (mode 644)
--- /dev/null
+++ config.mk.Linux
@@ -0,0 +1,4 @@
+CC		= cc
+SUDO		= sudo
+CFLAGS_OS	= -D_GNU_SOURCE=1
+LDFLAGS_OS	= -static
blob - 10dd1b856b79ac23af9c2869b2eb5b623d697c78
blob + 3173eb8aa553d0d1a0823d7a2ca83dc1da138995
--- src/ecall.c
+++ src/ecall.c
@@ -1,3 +1,6 @@
+#ifdef __linux__
+# include <sys/file.h>
+#endif
 #include <sys/resource.h>
 #include <sys/utsname.h>
 #include <sys/mman.h>
blob - d173422d7269a87bd9bc461fb94115f0977498e0
blob + 156608f9903fa2c229f72dc09bf641c0865a2f3a
--- src/exec.c
+++ src/exec.c
@@ -9,10 +9,13 @@
 
 int is_executable (const Elf64_Ehdr *ehdr)
 {
-	return IS_ELF (*ehdr)
-		&& ehdr->e_ident[EI_CLASS] == ELFCLASS64
-		&& ehdr->e_ident[EI_DATA] == ELFDATA2LSB
-		&& ehdr->e_machine == EM_RISCV
+	return     ehdr->e_ident[EI_MAG0]	== ELFMAG0
+		&& ehdr->e_ident[EI_MAG1]	== ELFMAG1
+		&& ehdr->e_ident[EI_MAG2]	== ELFMAG2
+		&& ehdr->e_ident[EI_MAG3]	== ELFMAG3
+		&& ehdr->e_ident[EI_CLASS]	== ELFCLASS64
+		&& ehdr->e_ident[EI_DATA]	== ELFDATA2LSB
+		&& ehdr->e_machine		== EM_RISCV
 		;
 }
 
blob - c4a75737828d8f647530bcb710baf137d1f439a3
blob + 71417b160e3090831eb0df565b762b44333bfb9a
--- tools/Makefile
+++ tools/Makefile
@@ -16,7 +16,7 @@ GMP_VER = 6.3.0
 MPFR_VER = 4.2.1
 MPC_VER = 1.3.1
 
-GMAKE = gmake -j8
+GMAKE = ${TOP}/gmake
 #SUDO = doas
 
 all: build
blob - 3cb5f2afc731ad975f04efb3e472d119ca0e2226
blob + 0b2fcbd58e1b0e3015360614c9ba5cfa3a9f31d8
--- tools/download
+++ tools/download
@@ -13,9 +13,9 @@ FreeBSD)
 	;;
 *)
 	if has 'wget'; then
-		wget -O "$1" "$2"
+		wget -qO "$1" "$2"
 	elif has 'curl'; then
-		curl -Lo "$1" "$2"
+		curl -sLo "$1" "$2"
 	else
 		echo "No download program found for $(uname)" >&2
 		exit 1
blob - /dev/null
blob + 351d45dfc5b81b06bdd2cce947359246cec2e42b (mode 755)
--- /dev/null
+++ tools/gmake
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+case "$(uname)" in
+Linux)
+	make "$@"
+	;;
+*BSD)
+	gmake "$@"
+	;;
+*)
+	echo "Unsupported OS: $(uname)" >&2
+	exit 1
+	;;
+esac