I updated my patch to only include the bare minimum definitions
required to get tcc to compile the newlib stdint.h header. Thank you
for the advice on using the config-extra.mak file, that worked
perfectly.
If this looks okay, then I will push this change to the mob branch.
Thanks,
-Sam Ellicott
Soli Deo Gloria
From b58e5328a806b6f644d81c291401a0c9bd6dfa9c Mon Sep 17 00:00:00 2001
From: Sam Ellicott <sellic...@cedarville.edu>
Date: Mon, 19 Jul 2021 22:42:25 -0400
Subject: [PATCH] tccdef.h additons for riscv64 newlib stdint

---
 include/tccdefs.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/include/tccdefs.h b/include/tccdefs.h
index ae0364e..dfcf4c9 100644
--- a/include/tccdefs.h
+++ b/include/tccdefs.h
@@ -24,6 +24,8 @@
 #else
     #define __SIZE_TYPE__ unsigned int
     #define __PTRDIFF_TYPE__ int
+    #define __UINTPTR_TYPE__ unsigned int 
+    #define __INTPTR_TYPE__ int 
 #endif
     #define __ILP32__ 1
     #define __INT64_TYPE__ long long
@@ -37,6 +39,8 @@
     /* Other 64bit systems. */
     #define __SIZE_TYPE__ unsigned long
     #define __PTRDIFF_TYPE__ long
+    #define __UINTPTR_TYPE__ long unsigned int
+    #define __INTPTR_TYPE__ long int
     #define __LP64__ 1
 # if defined __linux__
     #define __INT64_TYPE__ long
@@ -199,6 +203,8 @@
                                   & -(__alignof__(type)))
     #define __builtin_va_arg(ap,type) (*(sizeof(type) > (2*__va_reg_size) ? *(type **)((ap += __va_reg_size) - __va_reg_size) : (ap = (va_list)(_tcc_align(ap,type) + (sizeof(type)+__va_reg_size - 1)& -__va_reg_size), (type *)(ap - ((sizeof(type)+ __va_reg_size - 1)& -__va_reg_size)))))
 
+    // Define int32 type for stdint.h
+    #define __INT32_TYPE__ int
 #else /* __i386__ */
     typedef char *__builtin_va_list;
     #define __builtin_va_start(ap,last) (ap = ((char *)&(last)) + ((sizeof(last)+3)&~3))
-- 
2.32.0

_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to