Bug 17159 - windres messes strings up on big-endian hosts
Summary: windres messes strings up on big-endian hosts
Status: RESOLVED DUPLICATE of bug 31283
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.24
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-14 21:00 UTC by Stephen Kitt
Modified: 2024-03-18 14:41 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephen Kitt 2014-07-14 21:00:40 UTC
Hi,

This is forwarded from https://bugs.debian.org/754829. On s390x (I also checked on powerpc), windres miscompiles the following:

$ echo 'STRINGTABLE { 1, "String" }' | i686-w64-mingw32-windres

/* Type: stringtable

   Name: 1.  */
LANGUAGE 9, 1

STRINGTABLE MOVEABLE PURE DISCARDABLE
BEGIN
  1, L"\x5300\x7400\x7200\x6900\x6e00\x6700"
END


where the correct result would be, as produced on x86_64 for example:

$ echo 'STRINGTABLE { 1, "String" }' | i686-w64-mingw32-windres 

/* Type: stringtable

   Name: 1.  */
LANGUAGE 9, 1

STRINGTABLE MOVEABLE PURE DISCARDABLE
BEGIN
  1, "String"
END


Prefixing the string with L fixes things; on s390x:

$ echo 'STRINGTABLE { 1, L"String" }' | i686-w64-mingw32-windres           
/* Type: stringtable

   Name: 1.  */
LANGUAGE 9, 1

STRINGTABLE MOVEABLE PURE DISCARDABLE
BEGIN
  1, "String"
END


So I'm guessing this is something to do with the multibyte expansion in wind_MultiByteToWideChar()...

Regards,

Stephen
Comment 1 Stephen Kitt 2024-03-18 14:41:30 UTC
The big-endian fixes in https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3f8f9745c75b333515f399fc2908ede2ed8014e9 fixed this too.

*** This bug has been marked as a duplicate of bug 31283 ***