linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC/PATCH 1/2] sparse: Fix including glibc headers on x86-64
@ 2011-10-23 12:36 penberg
  2011-10-23 12:37 ` [RFC/PATCH 2/2] sparse: Use native sizes for data types penberg
  2012-03-23  8:59 ` [RFC/PATCH 1/2] sparse: Fix including glibc headers on x86-64 Christopher Li
  0 siblings, 2 replies; 12+ messages in thread
From: penberg @ 2011-10-23 12:36 UTC (permalink / raw)
  To: linux-sparse; +Cc: Pekka Enberg, Christopher Li, Jeff Garzik, Linus Torvalds

From: Pekka Enberg <penberg@kernel.org>

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@chrisli.org>
Cc: Jeff Garzik <jgarzik@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
---
 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


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2012-03-23 18:47 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-23 12:36 [RFC/PATCH 1/2] sparse: Fix including glibc headers on x86-64 penberg
2011-10-23 12:37 ` [RFC/PATCH 2/2] sparse: Use native sizes for data types penberg
2011-10-23 15:53   ` Jeff Garzik
2011-10-23 17:13     ` Josh Triplett
2011-10-24  7:06       ` Pekka Enberg
2012-03-23  8:59 ` [RFC/PATCH 1/2] sparse: Fix including glibc headers on x86-64 Christopher Li
2012-03-23  9:01   ` Benjamin Herrenschmidt
2012-03-23  9:13     ` Christopher Li
2012-03-23 10:03       ` Christopher Li
2012-03-23 18:03         ` Josh Triplett
2012-03-23 18:29           ` Christopher Li
2012-03-23 18:47             ` Christopher Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).