This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Binutils 2.20 - Windres problems building pthreads/libiconv on Open Solaris
On 10/02/2010 11:17, Tony Theodore wrote:
> Program received signal SIGSEGV, Segmentation fault.
> 0xcea46832 in iconv () from /lib/libc.so.1
> #0 0xcea46832 in iconv () from /lib/libc.so.1
> #1 0x08071dbd in iconv_onechar (cd=0xffffffff, s=0x81053d0 "FileDescription",
> d=0x8046940 "\022", d_len=32, n_s=0xffffffff, n_d=0xffffffff)
> at winduni.c:633
> #2 0x08071fc3 in wind_MultiByteToWideChar (cp=4294967295,
> mb=0x81053d0 "FileDescription", u=0x0, u_len=0) at winduni.c:694
> #3 0x08072052 in unicode_from_codepage (length=0x0, u=0x81053d0,
> src=0x81053d0 "FileDescription", cp=0) at winduni.c:584
> #4 0x080720ae in unicode_from_ascii (length=0x0, unicode=0x8046a28,
> ascii=0x81053d0 "FileDescription") at winduni.c:194
> #5 0x0806e74f in yyparse () at rcparse.y:1703
> #6 0x08064c2e in read_rc_file (filename=0x8047ad7 "version.rc",
> preprocessor=0x80e002c "gcc -E -xc -DRC_INVOKED",
> preprocargs=0x80dfd80 "", language=1033, use_temp_file=0) at resrc.c:562
> #7 0x08063aee in main (argc=3, argv=0x8047970) at windres.c:1025
I've reproduced this on osol0906jeos in a VM. What happens is that here:
> static rc_uint_type
> wind_MultiByteToWideChar (rc_uint_type cp, const char *mb,
> unichar *u, rc_uint_type u_len)
> {
> rc_uint_type ret = 0;
>
> #if defined (_WIN32) || defined (__CYGWIN__)
[ ... elided ... ]
> #elif defined (HAVE_ICONV)
> int first = 1;
> char tmp[32];
> char *p_tmp;
> const char *iconv_name = wind_iconv_cp (cp);
>
> if (!mb || !iconv_name)
> return 0;
> iconv_t cd = iconv_open ("UTF-16", iconv_name);
... this call to iconv_open fails (iconv_name is "MS-ANSI", returning
(iconv_t)-1 ...
> while (1)
> {
> int iret;
> const char *n_mb = "";
> char *n_tmp = "";
>
> p_tmp = tmp;
> iret = iconv_onechar (cd, (ICONV_CONST char *) mb, p_tmp, 32, & n_mb, & n_tmp);
... that we promptly go and use as if it were valid. Hmm, that's obviously
not good. Aborting with a "invalid code page" error of some kind is one thing
we could do. But the other thing I'm wondering is if MS-ANSI isn't just a
slightly non-standard name for CP1252, so maybe we could change the default to
use that one (or perhaps attempt it as a secondary fallback). I'm not very
familiar with iconv stuff, so I'll have to do some rtfming to make sure I've
got the right end of the stick, but one reference I found(*) suggests that my
be the case.
cheers,
DaveK
--
(*) - http://www.firstobject.com/character-set-name-alias-code-page.htm