Fix risc-v build (#305)
Two fixes in one: Firstly, replace non-standard __uint64_t with standard (but optional) uint64_t. __uint64_t is not a part of C standard; it is defined by some platforms but might not be present in every environment (e.g. in freestanding build). On the other hand, uint64_t is standard C. It is optional but virtual guaranteed to be present for any 32/64 bit machine. Secondly, mark riscv64 for 128-bit long double in make/cmake files. This fixes cmake build (which detects presence of long double and tries to compile extended functions), and brings make build to do the same. Co-authored-by: Viral B. Shah <ViralBShah@users.noreply.github.com>
This commit is contained in:
+1
-1
@@ -551,7 +551,7 @@ list(APPEND OPENLIBM_INCLUDE_DIRS
|
|||||||
if(${OPENLIBM_ARCH_FOLDER} STREQUAL "i387" OR ${OPENLIBM_ARCH_FOLDER} STREQUAL "amd64" OR ${OPENLIBM_ARCH_FOLDER} STREQUAL "powerpc")
|
if(${OPENLIBM_ARCH_FOLDER} STREQUAL "i387" OR ${OPENLIBM_ARCH_FOLDER} STREQUAL "amd64" OR ${OPENLIBM_ARCH_FOLDER} STREQUAL "powerpc")
|
||||||
list(APPEND OPENLIBM_INCLUDE_DIRS "${PROJECT_SRC}/ld80")
|
list(APPEND OPENLIBM_INCLUDE_DIRS "${PROJECT_SRC}/ld80")
|
||||||
else()
|
else()
|
||||||
if(${OPENLIBM_ARCH_FOLDER} STREQUAL "aarch64")
|
if(${OPENLIBM_ARCH_FOLDER} STREQUAL "aarch64" OR ${OPENLIBM_ARCH_FOLDER} STREQUAL "riscv64")
|
||||||
list(APPEND OPENLIBM_INCLUDE_DIRS "${PROJECT_SRC}/ld128")
|
list(APPEND OPENLIBM_INCLUDE_DIRS "${PROJECT_SRC}/ld128")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ CFLAGS_add += -std=c99 -Wall -I$(OPENLIBM_HOME) -I$(OPENLIBM_HOME)/include -I$(O
|
|||||||
ifneq ($(filter $(ARCH),i387 amd64 powerpc),)
|
ifneq ($(filter $(ARCH),i387 amd64 powerpc),)
|
||||||
CFLAGS_add += -I$(OPENLIBM_HOME)/ld80
|
CFLAGS_add += -I$(OPENLIBM_HOME)/ld80
|
||||||
else
|
else
|
||||||
ifneq ($(filter $(ARCH),aarch64),)
|
ifneq ($(filter $(ARCH),aarch64 riscv64),)
|
||||||
CFLAGS_add += -I$(OPENLIBM_HOME)/ld128
|
CFLAGS_add += -I$(OPENLIBM_HOME)/ld128
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@@ -165,7 +165,7 @@ ifneq ($(filter $(ARCH),i387 amd64),)
|
|||||||
# linux x86_64, for instance, `long double` is 80 bits wide, whereas on macOS aarch64,
|
# linux x86_64, for instance, `long double` is 80 bits wide, whereas on macOS aarch64,
|
||||||
# `long double` is the same as `double`.
|
# `long double` is the same as `double`.
|
||||||
LONG_DOUBLE_NOT_DOUBLE := 1
|
LONG_DOUBLE_NOT_DOUBLE := 1
|
||||||
else ifeq ($(ARCH), aarch64)
|
else ifeq ($(ARCH), aarch64 riscv64)
|
||||||
ifeq ($(filter $(OS),Darwin WINNT),)
|
ifeq ($(filter $(OS),Darwin WINNT),)
|
||||||
LONG_DOUBLE_NOT_DOUBLE := 1
|
LONG_DOUBLE_NOT_DOUBLE := 1
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -45,8 +45,8 @@
|
|||||||
#define __fenv_static static
|
#define __fenv_static static
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef __uint64_t fenv_t;
|
typedef uint64_t fenv_t;
|
||||||
typedef __uint64_t fexcept_t;
|
typedef uint64_t fexcept_t;
|
||||||
|
|
||||||
/* Exception flags */
|
/* Exception flags */
|
||||||
#define FE_INVALID 0x0010
|
#define FE_INVALID 0x0010
|
||||||
|
|||||||
Reference in New Issue
Block a user