[PATCH] slob: fix linking for user mode linux

From: Pekka J Enberg
Date: Mon Feb 11 2008 - 17:33:20 EST


From: Pekka Enberg <penberg@xxxxxxxxxxxxxx>

UML has some header magic that expects a non-inline __kmalloc() function to be
available. Fixes the following link time errors:

arch/um/drivers/built-in.o: In function `kmalloc':
/home/penberg/linux-2.6/arch/um/include/um_malloc.h:14: undefined reference to `__kmalloc'
/home/penberg/linux-2.6/arch/um/include/um_malloc.h:14: undefined reference to `__kmalloc'
/home/penberg/linux-2.6/arch/um/include/um_malloc.h:14: undefined reference to `__kmalloc'
/home/penberg/linux-2.6/arch/um/include/um_malloc.h:14: undefined reference to `__kmalloc'
/home/penberg/linux-2.6/arch/um/include/um_malloc.h:14: undefined reference to `__kmalloc'
arch/um/drivers/built-in.o:/home/penberg/linux-2.6/arch/um/include/um_malloc.h:14: more undefined references to `__kmalloc' follow

Cc: Jeff Dike <jdike@xxxxxxxxxxx>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@xxxxxxxx>
Cc: Matt Mackall <mpm@xxxxxxxxxxx>
Cc: Christoph Lameter <clameter@xxxxxxx>
Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxxxxxx>
---
Matt, does this look ok to you? Can we merge it via Christoph's tree?

include/linux/slob_def.h | 5 +----
mm/slob.c | 6 ++++++
2 files changed, 7 insertions(+), 4 deletions(-)

Index: linux-2.6/include/linux/slob_def.h
===================================================================
--- linux-2.6.orig/include/linux/slob_def.h 2008-01-12 01:00:37.000000000 +0200
+++ linux-2.6/include/linux/slob_def.h 2008-02-12 00:27:38.000000000 +0200
@@ -28,9 +28,6 @@
return __kmalloc_node(size, flags, -1);
}

-static inline void *__kmalloc(size_t size, gfp_t flags)
-{
- return kmalloc(size, flags);
-}
+extern void *__kmalloc(size_t size, gfp_t flags);

#endif /* __LINUX_SLOB_DEF_H */
Index: linux-2.6/mm/slob.c
===================================================================
--- linux-2.6.orig/mm/slob.c 2008-02-11 23:47:19.000000000 +0200
+++ linux-2.6/mm/slob.c 2008-02-12 00:27:38.000000000 +0200
@@ -486,6 +486,12 @@
}
EXPORT_SYMBOL(__kmalloc_node);

+void *__kmalloc(size_t size, gfp_t gfp)
+{
+ return __kmalloc_node(size, gfp, -1);
+}
+EXPORT_SYMBOL(__kmalloc);
+
void kfree(const void *block)
{
struct slob_page *sp;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/