[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 12/16] lib: Make stdarg work for GCC on RV64.
From: |
W. J. van der Laan |
Subject: |
[PATCH 12/16] lib: Make stdarg work for GCC on RV64. |
Date: |
Sat, 24 Apr 2021 14:27:09 +0000 |
* include/stdarg.h: GCC on RISC-V always passes arguments in registers.
Implementing these macros without the use of built-ins would be very
involved. So use those for now to make printf etc work.
---
include/stdarg.h | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/include/stdarg.h b/include/stdarg.h
index
6a8fee6ad2471c4f46102d9a07bc9359c6155f67..5e376fb5cde01b1b85cd16162f936935d27aea91
100644
--- a/include/stdarg.h
+++ b/include/stdarg.h
@@ -26,7 +26,19 @@
#define va_arg8(ap, type) va_arg(ap, type)
-#else // ! SYSTEM_LIBC
+#elif __GNUC__ && __riscv
+
+// GCC on RISC-V always passes arguments in registers. Implementing these
macros without
+// the use of built-ins would be very involved.
+typedef __builtin_va_list va_list;
+
+#define va_start(v,l) __builtin_va_start(v,l)
+#define va_end(v) __builtin_va_end(v)
+#define va_arg(v,l) __builtin_va_arg(v,l)
+#define va_arg8(ap, type) va_arg(ap, type)
+#define va_copy(d,s) __builtin_va_copy(d,s)
+
+#else // ! SYSTEM_LIBC && ! __riscv
#include <sys/types.h>
--
2.27.0
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH 12/16] lib: Make stdarg work for GCC on RV64.,
W. J. van der Laan <=