Fix panic when loading libiconv.ko on sparc64.

It seems that this issue only become obvious when compiled with -O2
on sparc64.

Since each struct iconv_converter_class has been initialized by
DEFINE_CLASS macro, not all members of struct iconv_converter_class
has been allocated on memory and cc_link member has not been
initialized, while iconv_register_converter() wanted to access it
with TAILQ.
Now we modify KICONV_CONVERTER macro and fix this bug.

Problem reported on:	freebsd-sparc64
Pointed out by:		yongari
Discussed with:		yongari
Tested by:		yongari
MFC after:		3 days
This commit is contained in:
R. Imura 2005-09-05 17:03:40 +00:00
parent 16901c0186
commit 884a8db7a8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=149799

View File

@ -128,8 +128,10 @@ struct iconv_cspair {
TAILQ_ENTRY(iconv_cspair) cp_link;
};
#define KICONV_CONVERTER(name,size) \
static DEFINE_CLASS(iconv_ ## name, iconv_ ## name ## _methods, (size)); \
#define KICONV_CONVERTER(name,size) \
static struct iconv_converter_class iconv_ ## name ## _class = { \
"iconv_"#name, iconv_ ## name ## _methods, size, NULL \
}; \
static moduledata_t iconv_ ## name ## _mod = { \
"iconv_"#name, iconv_converter_handler, \
(void*)&iconv_ ## name ## _class \