Package: binutils-mingw-w64-i686
Version: 2.28-5+7.4+b4
Severity: normal
Tags: patch

Dear Maintainer,

On 2018-10-01 a patch was applied to Wine to test custom dialog
control data:
https://source.winehq.org/git/wine.git/commit/606b0272776ec2a4e6146aa29a993fc88e98214b

Unfortunately i686-w64-mingw32-windres fails to compile the new resource
file:

../../.././../wine-native/tools/winegcc/winegcc -o user32_test.exe 
-B../../.././../wine-native/tools/winebuild \
  --sysroot=../../.. -b i686-w64-mingw32 -fasynchronous-unwind-tables 
broadcast.o class.o \
  clipboard.o combo.o cursoricon.o dce.o dde.o dialog.o edit.o generated.o 
input.o listbox.o menu.o \
  monitor.o msg.o resource.o scroll.o static.o sysparams.o text.o uitools.o 
win.o winstation.o \
  wsprintf.o resource.res testlist.o ../../../dlls/user32/libuser32.a 
../../../dlls/gdi32/libgdi32.a \
  ../../../dlls/advapi32/libadvapi32.a 
/usr/bin/i686-w64-mingw32-windres: dialog control data: not enough binary data

This is caused by a binutils bug which was fixed by Dmitry Timoshkov:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=6bb21700abb61cdb62a3d9fdf417971d528d5a37

The good news is that this is fixed in Debian Testingi. But since
Debian 9 is still the Debian release intended for mainstream use (and
also the release used by Wine's TestBot) fixing this in Debian Stable
would be really useful to Wine developers.

So I propose the attatched patch (of course the changelog entry should
be adjusted as approriate).

You can also find the patched package source and binaries there:
http://fgouget.free.fr/tmp/binutils-w64/binutils-mingw-w64_2.28-5+7.4+w1_all.deb
http://fgouget.free.fr/tmp/binutils-w64/binutils-mingw-w64_7.4+w1_amd64.buildinfo
http://fgouget.free.fr/tmp/binutils-w64/binutils-mingw-w64_7.4+w1_amd64.changes
http://fgouget.free.fr/tmp/binutils-w64/binutils-mingw-w64_7.4+w1.dsc
http://fgouget.free.fr/tmp/binutils-w64/binutils-mingw-w64_7.4+w1.tar.xz
http://fgouget.free.fr/tmp/binutils-w64/binutils-mingw-w64-i686_2.28-5+7.4+w1_amd64.deb
http://fgouget.free.fr/tmp/binutils-w64/binutils-mingw-w64-i686-dbgsym_2.28-5+7.4+w1_amd64.deb
http://fgouget.free.fr/tmp/binutils-w64/binutils-mingw-w64-x86-64_2.28-5+7.4+w1_amd64.deb
http://fgouget.free.fr/tmp/binutils-w64/binutils-mingw-w64-x86-64-dbgsym_2.28-5+7.4+w1_amd64.deb


-- System Information:
Debian Release: 9.5
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.9.0-8-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages binutils-mingw-w64-i686 depends on:
ii  binutils  2.28-5
ii  libc6     2.24-11+deb9u3
ii  zlib1g    1:1.2.8.dfsg-5

binutils-mingw-w64-i686 recommends no packages.

binutils-mingw-w64-i686 suggests no packages.

-- no debconf information
diff -ur binutils-mingw-w64-7.4/debian/changelog 
binutils-mingw-w64-7.4+w1/debian/changelog
--- binutils-mingw-w64-7.4/debian/changelog     2017-01-02 20:06:20.000000000 
+0100
+++ binutils-mingw-w64-7.4+w1/debian/changelog  2018-10-04 12:00:00.000000000 
+0200
@@ -1,3 +1,9 @@
+binutils-mingw-w64 (7.4+w1) unstable; urgency=medium
+
+  * Patched for Wine.
+
+ -- Francois Goguet <fgou...@codeweavers.com>  Thu, 04 Oct 2018 12:00:00 +0200
+
 binutils-mingw-w64 (7.4) unstable; urgency=medium
 
   * Add missing build dependencies on rdfind and symlinks.
diff -ur binutils-mingw-w64-7.4/debian/patches/series 
binutils-mingw-w64-7.4+w1/debian/patches/series
--- binutils-mingw-w64-7.4/debian/patches/series        2016-09-06 
13:18:43.000000000 +0200
+++ binutils-mingw-w64-7.4+w1/debian/patches/series     2017-01-02 
20:06:20.000000000 +0100
@@ -2,3 +2,6 @@
 specify-timestamp.patch
 dont-run-objcopy.patch
 default-secure-pe-flags.patch
+
+# Patches for Wine
+wine-fix-optional-dialog-control-data.patch
--- /dev/null   2018-09-25 02:08:19.254691583 +0200
+++ 
binutils-mingw-w64-7.4+w1/debian/patches/wine-fix-optional-dialog-control-data.patch
        2017-01-02 20:06:20.000000000 +0100
@@ -0,0 +1,92 @@
+From 6bb21700abb61cdb62a3d9fdf417971d528d5a37 Mon Sep 17 00:00:00 2001
+From: Dmitry Timoshkov <dmi...@baikal.ru>
+Date: Wed, 18 Jan 2017 11:40:06 +0000
+Subject: [PATCH] Stop the (optional) dialong control data from being aligned
+ when parsing/writing windows resource files.
+
+binutils* resbin.c: Optional dialog control data immediately follow
+       the control description without alignment.
+       * testsuite/binutils-all/windres/controldata.rc: New test.
+       source.
+       * testsuite/binutils-all/windres/controldata.rsd: New test.
+---
+ binutils/resbin.c                              |  7 ++-----
+ .../binutils-all/windres/controldata.rc        |  6 ++++++
+ .../binutils-all/windres/controldata.rsd       | 18 ++++++++++++++++++
+ 4 files changed, 34 insertions(+), 5 deletions(-)
+ create mode 100644 binutils/testsuite/binutils-all/windres/controldata.rc
+ create mode 100644 binutils/testsuite/binutils-all/windres/controldata.rsd
+
+diff --git a/upstream/binutils/resbin.c b/upstream/binutils/resbin.c
+index f836a5add6..07bce495ec 100644
+--- a/upstream/binutils/resbin.c
++++ b/upstream/binutils/resbin.c
+@@ -574,8 +574,6 @@ bin_to_res_dialog (windres_bfd *wrbfd, const bfd_byte 
*data, rc_uint_type length
+       dc->data = NULL;
+       else
+       {
+-        off = (off + 3) &~ 3;
+-
+         if (length < off + datalen)
+           toosmall (_("dialog control data"));
+ 
+@@ -1582,7 +1580,6 @@ res_to_bin_dialog (windres_bfd *wrbfd, rc_uint_type off, 
const rc_dialog *dialog
+       {
+         rc_uint_type saved_off = off;
+         rc_uint_type old_off;
+-        off += (4 - ((off - off_delta) & 3)) & 3;
+ 
+         old_off = off;
+         off = res_to_bin_rcdata (wrbfd, off, dc->data);
+@@ -1590,10 +1587,10 @@ res_to_bin_dialog (windres_bfd *wrbfd, rc_uint_type 
off, const rc_dialog *dialog
+           old_off = off = saved_off;
+         if (wrbfd)
+           windres_put_16 (wrbfd, dc_rclen, off - old_off);
+-          }
++      }
+       if (wrbfd)
+       set_windres_bfd_content (wrbfd, dc_rclen, marker, 2);
+-      }
++    }
+ 
+   if (wrbfd)
+     {
+diff --git a/upstream/binutils/testsuite/binutils-all/windres/controldata.rc 
b/upstream/binutils/testsuite/binutils-all/windres/controldata.rc
+new file mode 100644
+index 0000000000..67b8df2f80
+--- /dev/null
++++ b/upstream/binutils/testsuite/binutils-all/windres/controldata.rc
+@@ -0,0 +1,6 @@
++1 DIALOGEX DISCARDABLE 0, 0, 200, 150
++STYLE 0
++BEGIN
++  CONTROL "evenlengthtext", -1, "TESTCONTROL", 0x50810000, 10,10,100,50 { 
1,2,3,4,5 }
++  CONTROL "oddlengthtext", -1, "TESTCONTROL", 0x50810000, 10,60,100,50 { 
1,2,3,4,5 }
++END
+diff --git a/upstream/binutils/testsuite/binutils-all/windres/controldata.rsd 
b/upstream/binutils/testsuite/binutils-all/windres/controldata.rsd
+new file mode 100644
+index 0000000000..1357e056e9
+--- /dev/null
++++ b/upstream/binutils/testsuite/binutils-all/windres/controldata.rsd
+@@ -0,0 +1,18 @@
++ 0000 00000000 20000000 ffff0000 ffff0000  .... ...........
++ 0010 00000000 00000000 00000000 00000000  ................
++ 0020 d4000000 20000000 ffff0500 ffff0100  .... ...........
++ 0030 00000000 30100904 00000000 00000000  ....0...........
++ 0040 0100ffff 00000000 00000000 00000000  ................
++ 0050 02000000 0000c800 96000000 00000000  ................
++ 0060 00000000 00000000 00008150 0a000a00  ...........P....
++ 0070 64003200 ffffffff 54004500 53005400  d.2.....T.E.S.T.
++ 0080 43004f00 4e005400 52004f00 4c000000  C.O.N.T.R.O.L...
++ 0090 65007600 65006e00 6c006500 6e006700  e.v.e.n.l.e.n.g.
++ 00a0 74006800 74006500 78007400 00000a00  t.h.t.e.x.t.....
++ 00b0 01000200 03000400 05000000 00000000  ................
++ 00c0 00000000 00008150 0a003c00 64003200  .......P..<.d.2.
++ 00d0 ffffffff 54004500 53005400 43004f00  ....T.E.S.T.C.O.
++ 00e0 4e005400 52004f00 4c000000 6f006400  N.T.R.O.L...o.d.
++ 00f0 64006c00 65006e00 67007400 68007400  d.l.e.n.g.t.h.t.
++ 0100 65007800 74000000 0a000100 02000300  e.x.t...........
++ 0110 04000500                             ....            
+-- 
+2.19.0
+

Reply via email to