Bug 13409 - windres should specify host endianness for iconv explicitly
Summary: windres should specify host endianness for iconv explicitly
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.24
: P2 critical
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks: 11337
  Show dependency treegraph
 
Reported: 2011-11-14 11:04 UTC by Yuji Kuwabara
Modified: 2013-03-27 12:07 UTC (History)
2 users (show)

See Also:
Host: FreeBSD, Mac OS X (little-endian)
Target: i386-mingw32msvc (little-endian)
Build:
Last reconfirmed:


Attachments
Patch against version 2.22 (288 bytes, patch)
2012-06-07 21:32 UTC, Phil Krylov
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yuji Kuwabara 2011-11-14 11:04:49 UTC
I installed binutils onto Mac OSX (host, i686 little endian) for mingw32msvc (target, i386 little endian).
windres writes resource id and name string (not integer) in big endian into COFF.
I investigated a function  wind_MultiByteToWideChar() in "winduni.c" .
I changed an argument,
  iconv_open ("UTF-16", iconv_name);
to
  iconv_open ("UTF-16LE", iconv_name);

This fixed the problem.

Regards.
Comment 1 Yuji Kuwabara 2011-11-14 13:04:45 UTC
Sorry, these are resource type and resource name (not ID).

Regards.
Comment 2 Phil Krylov 2012-06-07 21:06:57 UTC
Same with version 2.22 of binutils and FreeBSD6.
Comment 3 Phil Krylov 2012-06-07 21:32:37 UTC
Created attachment 6441 [details]
Patch against version 2.22
Comment 4 Phil Krylov 2012-06-30 15:45:48 UTC
The bug is present in 2.21, 2.22, and 2.23 (HEAD)
Comment 5 Sourceware Commits 2013-03-27 11:53:48 UTC
CVSROOT:	/cvs/src
Module name:	src
Changes by:	nickc@sourceware.org	2013-03-27 11:53:46

Modified files:
	binutils       : ChangeLog winduni.c 

Log message:
	PR binutils/13409
	* winduni.c (codepages[]): Use UTF-16LE.
	(wind_MultiByteToWideChar): Likewise.
	(wind_WideCharToMultiByte): Likewise.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/binutils/ChangeLog.diff?cvsroot=src&r1=1.2006&r2=1.2007
http://sourceware.org/cgi-bin/cvsweb.cgi/src/binutils/winduni.c.diff?cvsroot=src&r1=1.15&r2=1.16
Comment 6 Nick Clifton 2013-03-27 11:54:55 UTC
Hi Yuji, Hi Phil,

      Thanks for the bug report.  I have applied Phil's patch.

heers
      Nick
Comment 7 Phil Krylov 2013-03-27 12:07:11 UTC
Thanks, Nick.