[PATCH 11/11] add predefined macros for [u]int32_t

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



These are a pain. All LP64 archs use [u]int. Good.
But some LP32 archs use [u]int and some others use [u]long.
Some even use [u]int for some ABI and [u]loing for some others
(bare metal).

This really need to be target-specific to be correct.
---
 lib.c    | 10 ++++++++++
 target.c |  2 ++
 target.h |  2 ++
 3 files changed, 14 insertions(+)

diff --git a/lib.c b/lib.c
index 062f24c16..942a3d5d8 100644
--- a/lib.c
+++ b/lib.c
@@ -492,6 +492,14 @@ static void handle_arch_m64_finalize(void)
 		goto case_x86_64;
 	case ARCH_LP32:
 		/* default values */
+#if defined(__m68k__) \
+	|| ((defined(__sparc__) || defined(__sparc)) && !defined(__sparc_v9__)) \
+	|| defined(__mips__) || defined(__mips) \
+	|| defined(__powerpc__) || defined(__PPC__) || defined(PPC) \
+	|| defined(__riscv__) || defined(__riscv)
+		int32_ctype = &long_ctype;
+		uint32_ctype = &ulong_ctype;
+#endif
 		int64_ctype = &llong_ctype;
 		uint64_ctype = &ullong_ctype;
 		intmax_ctype = &llong_ctype;
@@ -1268,6 +1276,8 @@ static void predefined_macros(void)
 	predefined_ctype("UINT8",  &schar_ctype,  PTYPE_TYPE|PTYPE_MAX);
 	predefined_ctype("INT16",  &short_ctype,  PTYPE_TYPE|PTYPE_MAX);
 	predefined_ctype("UINT16", &ushort_ctype, PTYPE_TYPE|PTYPE_MAX);
+	predefined_ctype("INT32",  int32_ctype,  PTYPE_TYPE|PTYPE_MAX);
+	predefined_ctype("UINT32", uint32_ctype, PTYPE_TYPE|PTYPE_MAX);
 	predefined_ctype("INT64",  int64_ctype,  PTYPE_TYPE|PTYPE_MAX);
 	predefined_ctype("UINT64", uint64_ctype, PTYPE_TYPE|PTYPE_MAX);
 
diff --git a/target.c b/target.c
index 6e948dfeb..e626424ff 100644
--- a/target.c
+++ b/target.c
@@ -9,6 +9,8 @@ struct symbol *intmax_ctype = &llong_ctype;
 struct symbol *uintmax_ctype = &ullong_ctype;
 struct symbol *int64_ctype = &long_ctype;
 struct symbol *uint64_ctype = &ulong_ctype;
+struct symbol *int32_ctype = &int_ctype;
+struct symbol *uint32_ctype = &uint_ctype;
 struct symbol *wchar_ctype = &int_ctype;
 
 /*
diff --git a/target.h b/target.h
index 4ecbb9a6b..f11e8675d 100644
--- a/target.h
+++ b/target.h
@@ -7,6 +7,8 @@ extern struct symbol *intmax_ctype;
 extern struct symbol *uintmax_ctype;
 extern struct symbol *int64_ctype;
 extern struct symbol *uint64_ctype;
+extern struct symbol *int32_ctype;
+extern struct symbol *uint32_ctype;
 extern struct symbol *wchar_ctype;
 
 /*
-- 
2.19.0




[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux