2002-10-03 05:47:39

by Tobias Ringstrom

[permalink] [raw]
Subject: 2.5.40: CONFIG_CRC32=Y is broken

I seems that CONFIG_CRC32=Y is broken. The symbols crc32_le and crc32_be
do not appear in the System.map file, and insmod complains about crc32_be
being missing when trying to load the module via-rhine.o.

I suspect that it happens because crc32.o is put in a lib file (.a), and
since the functions are not used at link time, the file (crc32.o) is
dropped.

/Tobias


2002-10-03 15:32:41

by Kai Germaschewski

[permalink] [raw]
Subject: Re: 2.5.40: CONFIG_CRC32=Y is broken

On Thu, 3 Oct 2002, Tobias Ringstrom wrote:

> I seems that CONFIG_CRC32=Y is broken. The symbols crc32_le and crc32_be
> do not appear in the System.map file, and insmod complains about crc32_be
> being missing when trying to load the module via-rhine.o.
>
> I suspect that it happens because crc32.o is put in a lib file (.a), and
> since the functions are not used at link time, the file (crc32.o) is
> dropped.

Yes. There is actually one reference to crc32_[lb]e, from __ksymtab, as
generated by the EXPORT_SYMBOL statement. Unfortunately, the __ksymtab
entry is not referenced anywhere, either, so the whole things still gets
dropped. One way to fix it is to make sure the the EXPORT_SYMBOL() is a
file which definitely gets linked in, as in the patch below.

BTW, I strongly suspect that crc32.o is broken when compiled modular,
since in this case init_crc32() won't be called.

--Kai


===== kernel/ksyms.c 1.139 vs edited =====
--- 1.139/kernel/ksyms.c Sun Sep 29 23:39:05 2002
+++ edited/kernel/ksyms.c Thu Oct 3 10:30:08 2002
@@ -54,6 +54,7 @@
#include <linux/percpu.h>
#include <linux/smp_lock.h>
#include <linux/dnotify.h>
+#include <linux/crc32.h>
#include <asm/checksum.h>

#if defined(CONFIG_PROC_FS)
@@ -585,6 +586,10 @@
EXPORT_SYMBOL(strnicmp);
EXPORT_SYMBOL(strspn);
EXPORT_SYMBOL(strsep);
+#ifdef CONFIG_CRC32
+EXPORT_SYMBOL(crc32_le);
+EXPORT_SYMBOL(crc32_be);
+#endif

/* software interrupts */
EXPORT_SYMBOL(tasklet_init);
===== lib/Makefile 1.13 vs edited =====
--- 1.13/lib/Makefile Sun Sep 15 16:04:18 2002
+++ edited/lib/Makefile Thu Oct 3 10:27:03 2002
@@ -9,7 +9,7 @@
L_TARGET := lib.a

export-objs := cmdline.o dec_and_lock.o rwsem-spinlock.o rwsem.o \
- crc32.o rbtree.o radix-tree.o
+ rbtree.o radix-tree.o

obj-y := errno.o ctype.o string.o vsprintf.o brlock.o cmdline.o \
bust_spinlocks.o rbtree.o radix-tree.o dump_stack.o
===== lib/crc32.c 1.5 vs edited =====
--- 1.5/lib/crc32.c Mon Apr 8 15:22:00 2002
+++ edited/lib/crc32.c Thu Oct 3 10:26:50 2002
@@ -566,6 +566,3 @@

fs_initcall(init_crc32);
module_exit(cleanup_crc32);
-
-EXPORT_SYMBOL(crc32_le);
-EXPORT_SYMBOL(crc32_be);