[PATCH] make -m32/-m64 more useful

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

 



The option -m64 to just set the size of longs & pointers to 64 bits.

This patch makes this option much more effective by:
- adding define for LONG_MAX & SIZEOF_POINTER
- define __LP64__
- let the dual option, -m32, do the same as -m64 but for 32 bit
---
 lib.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/lib.c b/lib.c
index d5b56b01..e5b0bb63 100644
--- a/lib.c
+++ b/lib.c
@@ -402,9 +402,21 @@ static void handle_arch_m64_finalize(void)
 		pointer_alignment = 8;
 		size_t_ctype = &ulong_ctype;
 		ssize_t_ctype = &long_ctype;
+		add_pre_buffer("#weak_define __LONG_MAX__ 0x7fffffffffffffff\n");
+		add_pre_buffer("#weak_define __SIZEOF_POINTER__ 8\n");
+		add_pre_buffer("#weak_define __LP64__ 1\n");
 #ifdef __x86_64__
 		add_pre_buffer("#weak_define __x86_64__ 1\n");
 #endif
+	} else {
+		bits_in_long = 32;
+		max_int_alignment = 4;
+		bits_in_pointer = 32;
+		pointer_alignment = 4;
+		size_t_ctype = &ulong_ctype;
+		ssize_t_ctype = &long_ctype;
+		add_pre_buffer("#weak_define __LONG_MAX__ 0x7fffffff\n");
+		add_pre_buffer("#weak_define __SIZEOF_POINTER__ 4\n");
 	}
 }
 
-- 
2.10.2

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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