[libc-commits] [libc] e9be85d - [libc] Add fenv_t and signal macros in riscv

Mikhail R. Gadelha via libc-commits libc-commits at lists.llvm.org
Wed Mar 8 12:34:38 PST 2023


Author: Mikhail R. Gadelha
Date: 2023-03-08T17:31:58-03:00
New Revision: e9be85da8bad26146078f6888cc516ff83d5e7b4

URL: https://github.com/llvm/llvm-project/commit/e9be85da8bad26146078f6888cc516ff83d5e7b4
DIFF: https://github.com/llvm/llvm-project/commit/e9be85da8bad26146078f6888cc516ff83d5e7b4.diff

LOG: [libc] Add fenv_t and signal macros in riscv

This patch now enables full build.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D145594

Added: 
    

Modified: 
    libc/include/llvm-libc-macros/linux/signal-macros.h
    libc/include/llvm-libc-types/fenv_t.h
    libc/src/__support/FPUtil/FEnvImpl.h

Removed: 
    


################################################################################
diff  --git a/libc/include/llvm-libc-macros/linux/signal-macros.h b/libc/include/llvm-libc-macros/linux/signal-macros.h
index 069a233477979..4dc39dec47de8 100644
--- a/libc/include/llvm-libc-macros/linux/signal-macros.h
+++ b/libc/include/llvm-libc-macros/linux/signal-macros.h
@@ -82,6 +82,9 @@
 #elif defined(__aarch64__)
 #define MINSIGSTKSZ 5120
 #define SIGSTKSZ 16384
+#elif defined(__riscv)
+#define MINSIGSTKSZ 2048
+#define SIGSTKSZ 8192
 #else
 #error "Signal stack sizes not defined for your platform."
 #endif

diff  --git a/libc/include/llvm-libc-types/fenv_t.h b/libc/include/llvm-libc-types/fenv_t.h
index 3e33a1727b333..6d2bea74560db 100644
--- a/libc/include/llvm-libc-types/fenv_t.h
+++ b/libc/include/llvm-libc-types/fenv_t.h
@@ -23,6 +23,8 @@ typedef struct {
 typedef struct {
   unsigned int __fpscr;
 } fenv_t;
+#elif defined(__riscv)
+typedef unsigned int fenv_t;
 #else
 #error "fenv_t not defined for your platform"
 #endif

diff  --git a/libc/src/__support/FPUtil/FEnvImpl.h b/libc/src/__support/FPUtil/FEnvImpl.h
index 43980a87afc64..ee2bd16e821d9 100644
--- a/libc/src/__support/FPUtil/FEnvImpl.h
+++ b/libc/src/__support/FPUtil/FEnvImpl.h
@@ -46,6 +46,10 @@ LIBC_INLINE int set_except(int) { return 0; }
 
 LIBC_INLINE int raise_except(int) { return 0; }
 
+LIBC_INLINE int enable_except(int) { return 0; }
+
+LIBC_INLINE int disable_except(int) { return 0; }
+
 LIBC_INLINE int get_round() { return FE_TONEAREST; }
 
 LIBC_INLINE int set_round(int) { return 0; }


        


More information about the libc-commits mailing list