[libc-commits] [PATCH] D145594: [libc] Add fenv_t and signal macros in riscv

Mikhail Ramalho via Phabricator via libc-commits libc-commits at lists.llvm.org
Wed Mar 8 09:32:00 PST 2023


mikhail.ramalho created this revision.
mikhail.ramalho added a reviewer: sivachandra.
Herald added subscribers: libc-commits, VincentWu, vkmr, ecnelises, evandro, sameer.abuasal, tschuett, s.egerton, Jim, benna, psnobl, rogfer01, shiva0217, kito-cheng, simoncook, arichardson.
Herald added projects: libc-project, All.
mikhail.ramalho requested review of this revision.
Herald added subscribers: pcwang-thead, eopXD.

This patch now enables full build.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D145594

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


Index: libc/src/__support/FPUtil/FEnvImpl.h
===================================================================
--- libc/src/__support/FPUtil/FEnvImpl.h
+++ libc/src/__support/FPUtil/FEnvImpl.h
@@ -46,6 +46,10 @@
 
 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; }
Index: libc/include/llvm-libc-types/fenv_t.h
===================================================================
--- libc/include/llvm-libc-types/fenv_t.h
+++ libc/include/llvm-libc-types/fenv_t.h
@@ -26,5 +26,8 @@
 #else
 #error "fenv_t not defined for your platform"
 #endif
+#ifdef __riscv
+typedef unsigned int fenv_t;
+#endif
 
 #endif // __LLVM_LIBC_TYPES_FENV_T_H__
Index: libc/include/llvm-libc-macros/linux/signal-macros.h
===================================================================
--- libc/include/llvm-libc-macros/linux/signal-macros.h
+++ 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
Index: libc/config/linux/app.h
===================================================================
--- libc/config/linux/app.h
+++ libc/config/linux/app.h
@@ -35,7 +35,9 @@
   uintptr_t align;
 };
 
-#if defined(LIBC_TARGET_ARCH_IS_X86_64) || defined(LIBC_TARGET_ARCH_IS_AARCH64)
+#if defined(LIBC_TARGET_ARCH_IS_X86_64) ||                                     \
+    defined(LIBC_TARGET_ARCH_IS_AARCH64) ||                                    \
+    defined(LIBC_TARGET_ARCH_IS_RISCV64)
 // At the language level, argc is an int. But we use uint64_t as the x86_64
 // ABI specifies it as an 8 byte value. Likewise, in the ARM64 ABI, arguments
 // are usually passed in registers.  x0 is a doubleword register, so this is


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145594.503412.patch
Type: text/x-patch
Size: 2049 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230308/6969e794/attachment.bin>


More information about the libc-commits mailing list