[PATCH] fix for MIPS system headers needing _MIPS_SZ{INT,LONG,PTR}

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

 



System headers (at least glibc's ones) define and use __WORDSIZE
which, on most archs, is defined depending on __LP64 or __ILP32.
But on MIPS, __WORDISZE is defined depending on the value of the
builtin macro _MIPS_SZPTR.

So, add the predefine for _MIPS_SZPTR on MIPS.

Reported-by: Uwe Kleine-König <uwe@xxxxxxxxxxxxxxxxx>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 lib.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lib.c b/lib.c
index b68d0ff2b..ee439b5b9 100644
--- a/lib.c
+++ b/lib.c
@@ -1320,6 +1320,15 @@ static void predefined_macros(void)
 		predefine("__x86_64", 1, "1");
 #endif
 	}
+
+	switch (arch_mach) {
+	case MACH_MIPS64:
+	case MACH_MIPS32:
+		predefine("_MIPS_SZINT", 1, "%d", int_ctype.bit_size);
+		predefine("_MIPS_SZLONG", 1, "%d", long_ctype.bit_size);
+		predefine("_MIPS_SZPTR", 1, "%d", ptr_ctype.bit_size);
+		break;
+	}
 }
 
 static void create_builtin_stream(void)
-- 
2.20.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