aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilly Tarreau <w@1wt.eu>2009-07-20 00:54:17 +0200
committerWilly Tarreau <w@1wt.eu>2009-07-20 01:25:16 +0200
commit9eb03a2e18e8c305cb7e01ad3c424a1621c2ff2a (patch)
tree6f2a734c52ae5f23fa78e7316170cbd8f4f0e65b
parentdcc303dd0b5133767ae0487db444a58f8636fc46 (diff)
downloadlinux-2.4-9eb03a2e18e8c305cb7e01ad3c424a1621c2ff2a.tar.gz
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.
-rw-r--r--lib/Makefile2
-rw-r--r--lib/string.c3
2 files changed, 4 insertions, 1 deletions
diff --git a/lib/Makefile b/lib/Makefile
index 7c629c14a6b811..2b402cb101d02d 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 c6c8158f74704a..7a45ee81fc4c3b 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 @@ void * memmove(void * dest,const void *src,size_t count)
* @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 @@ int memcmp(const void * cs,const void * ct,size_t count)
break;
return res;
}
+EXPORT_SYMBOL(memcmp);
#endif
#ifndef __HAVE_ARCH_MEMSCAN