[RFC/PATCH 1/2] sparse: Fix including glibc headers on x86-64

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

 



From: Pekka Enberg <penberg@xxxxxxxxxx>

Sparse treats code as 32-bit which causes problems for userspace projects on
x86-64 Fedora if you don't have the 32-bit glibc compat package installed
("glib-devel.i686"):

  $ ./sparse allocate.c
  /usr/include/gnu/stubs.h:7:12: error: unable to open 'gnu/stubs-32.h'

Fix the issue by defining relevant macros on 64-bit.

Cc: Christopher Li <sparse@xxxxxxxxxxx>
Cc: Jeff Garzik <jgarzik@xxxxxxxxxx>
Cc: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxx>
---
 lib.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/lib.c b/lib.c
index 396e9f1..f372296 100644
--- a/lib.c
+++ b/lib.c
@@ -827,6 +827,12 @@ void create_builtin_stream(void)
 	add_pre_buffer("#weak_define __LONG_MAX__ " STRINGIFY(__LONG_MAX__) "\n");
 	add_pre_buffer("#weak_define __LONG_LONG_MAX__ " STRINGIFY(__LONG_LONG_MAX__) "\n");
 	add_pre_buffer("#weak_define __WCHAR_MAX__ " STRINGIFY(__WCHAR_MAX__) "\n");
+
+#ifdef __x86_64
+	add_pre_buffer("#weak_define x86_64 1\n");
+	add_pre_buffer("#weak_define __x86_64 1\n");
+	add_pre_buffer("#weak_define __x86_64__ 1\n");
+#endif
 }
 
 static struct symbol_list *sparse_tokenstream(struct token *token)
-- 
1.7.6.4

--
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