lib: export memcmp for external modules to build with gcc 3.4
When building external modules for a kernel built with gcc-3.4, it
sometimes happens that the module depends on memcmp() which is not
defined. x86 only relies on __builtin_memcmp() which is not always
available on other gccs. Since the mapping of memcmp() to
__builtin_memcmp() is performed using a #define, no memcmp() symbol
is declared. We have to export it in lib/string.c, as in 2.6.
Note that 2.6 also undefines a few other symbols and exports all
symbols. Right now this does not seem absolutely necessary on 2.4,
so let's not touch this for now.
diff --git a/lib/Makefile b/lib/Makefile
index 7c629c1..2b402cb 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -9,7 +9,7 @@
L_TARGET := lib.a
export-objs := cmdline.o dec_and_lock.o rwsem-spinlock.o rwsem.o \
- rbtree.o crc32.o firmware_class.o
+ rbtree.o crc32.o firmware_class.o string.o
obj-y := errno.o ctype.o string.o vsprintf.o brlock.o cmdline.o \
bust_spinlocks.o rbtree.o dump_stack.o
diff --git a/lib/string.c b/lib/string.c
index c6c8158..7a45ee8 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -18,6 +18,7 @@
#include <linux/types.h>
#include <linux/string.h>
#include <linux/ctype.h>
+#include <linux/module.h>
#ifndef __HAVE_ARCH_STRNICMP
/**
@@ -448,6 +449,7 @@
* @ct: Another area of memory
* @count: The size of the area.
*/
+#undef memcmp
int memcmp(const void * cs,const void * ct,size_t count)
{
const unsigned char *su1, *su2;
@@ -458,6 +460,7 @@
break;
return res;
}
+EXPORT_SYMBOL(memcmp);
#endif
#ifndef __HAVE_ARCH_MEMSCAN