diff --git a/Make.inc b/Make.inc index adeb33d..1556c60 100644 --- a/Make.inc +++ b/Make.inc @@ -131,6 +131,10 @@ ifeq ($(ARCH),wasm32) CFLAGS_arch += -ffreestanding -nostdlib -nostdinc --target=wasm32-unknown-unknown endif +ifeq ($(ARCH),sh3eb) +CFLAGS_arch += -ffreestanding -nostdlib -m3 -mb +endif + # Add our "arch"-related FLAGS in. We separate arch-related flags out so that # we can conveniently get at them for targets that don't want the rest of # *FLAGS_add, such as the testing Makefile targets diff --git a/Makefile b/Makefile index 865123e..149fe45 100644 --- a/Makefile +++ b/Makefile @@ -53,7 +53,7 @@ endif OLM_LIBS := libopenlibm.a -ifneq ($(ARCH), wasm32) +ifeq ($(filter wasm32 sh3eb,$(ARCH)),) OLM_LIBS += libopenlibm.$(OLM_MAJOR_MINOR_SHLIB_EXT) endif diff --git a/include/openlibm_fenv.h b/include/openlibm_fenv.h index c052d2d..5439dbf 100644 --- a/include/openlibm_fenv.h +++ b/include/openlibm_fenv.h @@ -14,6 +14,8 @@ #include #elif defined(__s390__) #include +#elif defined(__sh3__) +#include #else #error "Unsupported platform" #endif diff --git a/sh3eb/Make.files b/sh3eb/Make.files new file mode 100644 index 0000000..483a7cc --- /dev/null +++ b/sh3eb/Make.files @@ -0,0 +1 @@ +$(CUR_SRCS) = fenv.c diff --git a/sh3eb/assert.h b/sh3eb/assert.h new file mode 100644 index 0000000..f0bda9d --- /dev/null +++ b/sh3eb/assert.h @@ -0,0 +1,2 @@ +#pragma once +#define assert(b) diff --git a/sh3eb/ctype.h b/sh3eb/ctype.h new file mode 100644 index 0000000..76aec7b --- /dev/null +++ b/sh3eb/ctype.h @@ -0,0 +1,7 @@ +#pragma once + +static int isxdigit(int c) +{ + return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || + (c >= 'a' && c <= 'f'); +} diff --git a/sh3eb/string.h b/sh3eb/string.h new file mode 100644 index 0000000..99047b5 --- /dev/null +++ b/sh3eb/string.h @@ -0,0 +1,4 @@ +#pragma once +#include + +void *memset(void *mem, int fill, size_t size); diff --git a/src/fpmath.h b/src/fpmath.h index 61d2288..2052b22 100644 --- a/src/fpmath.h +++ b/src/fpmath.h @@ -43,6 +43,8 @@ #include "mips_fpmath.h" #elif defined(__s390__) #include "s390_fpmath.h" +#elif defined(__sh3__) +#include "sh3eb_fpmath.h" #endif /* Definitions provided directly by GCC and Clang. */ diff --git a/src/sh3eb_fpmath.h b/src/sh3eb_fpmath.h index 50f119f..babae44 100644 --- a/src/sh3eb_fpmath.h +++ b/src/sh3eb_fpmath.h @@ -29,7 +29,7 @@ union IEEEl2bits { long double e; struct { -#ifndef __MIPSEB__ +#ifndef __BIG_ENDIAN__ unsigned int manl :32; unsigned int manh :20; unsigned int exp :11;