Skip to content

Commit a91cde1

Browse files
committed
Fix risc-v build
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.
1 parent d66f477 commit a91cde1

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ list(APPEND OPENLIBM_INCLUDE_DIRS
551551
if(${OPENLIBM_ARCH_FOLDER} STREQUAL "i387" OR ${OPENLIBM_ARCH_FOLDER} STREQUAL "amd64" OR ${OPENLIBM_ARCH_FOLDER} STREQUAL "powerpc")
552552
list(APPEND OPENLIBM_INCLUDE_DIRS "${PROJECT_SRC}/ld80")
553553
else()
554-
if(${OPENLIBM_ARCH_FOLDER} STREQUAL "aarch64")
554+
if(${OPENLIBM_ARCH_FOLDER} STREQUAL "aarch64" OR ${OPENLIBM_ARCH_FOLDER} STREQUAL "riscv64")
555555
list(APPEND OPENLIBM_INCLUDE_DIRS "${PROJECT_SRC}/ld128")
556556
endif()
557557
endif()

Make.inc

+2-2
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ CFLAGS_add += -std=c99 -Wall -I$(OPENLIBM_HOME) -I$(OPENLIBM_HOME)/include -I$(O
155155
ifneq ($(filter $(ARCH),i387 amd64 powerpc),)
156156
CFLAGS_add += -I$(OPENLIBM_HOME)/ld80
157157
else
158-
ifneq ($(filter $(ARCH),aarch64),)
158+
ifneq ($(filter $(ARCH),aarch64 riscv64),)
159159
CFLAGS_add += -I$(OPENLIBM_HOME)/ld128
160160
endif
161161
endif
@@ -165,7 +165,7 @@ ifneq ($(filter $(ARCH),i387 amd64),)
165165
# linux x86_64, for instance, `long double` is 80 bits wide, whereas on macOS aarch64,
166166
# `long double` is the same as `double`.
167167
LONG_DOUBLE_NOT_DOUBLE := 1
168-
else ifeq ($(ARCH), aarch64)
168+
else ifeq ($(ARCH), aarch64 riscv64)
169169
ifeq ($(filter $(OS),Darwin WINNT),)
170170
LONG_DOUBLE_NOT_DOUBLE := 1
171171
endif

include/openlibm_fenv_riscv.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545
#define __fenv_static static
4646
#endif
4747

48-
typedef __uint64_t fenv_t;
49-
typedef __uint64_t fexcept_t;
48+
typedef uint64_t fenv_t;
49+
typedef uint64_t fexcept_t;
5050

5151
/* Exception flags */
5252
#define FE_INVALID 0x0010

0 commit comments

Comments
 (0)