Your message dated Tue, 18 Jun 2019 07:18:34 +0000
with message-id <e1hd8o2-0001b1...@fasolo.debian.org>
and subject line Bug#928214: fixed in gcc-mingw-w64 21.3
has caused the Debian Bug report #928214,
regarding mingw-w64 GCC is built without linker plugin support making LTO 
unusable
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)


-- 
928214: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=928214
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
Package: gcc-mingw-w64
Version: 21.2

Hi!

I've discovered that mingw-w64 GCC in Debian is configured without linker plugin support: $ x86_64-w64-mingw32-gcc -x c - -flto -fno-fat-lto-objects <<<'int main() {}'
cc1: error: -fno-fat-lto-objects are supported only with linker plugin

This makes LTO unusable in many real-world cases. Consider the following example:

$ grep . *.c
foo.c:int foo() {return 42;}
main.c:int main() {return foo();}
$ x86_64-w64-mingw32-gcc -flto -O2 foo.c main.c -c
$ x86_64-w64-mingw32-ar cr app.a main.o foo.o
$ x86_64-w64-mingw32-gcc -flto -O2 app.a
$ x86_64-w64-mingw32-objdump -d a.exe | grep '<main>:' -A 5
0000000000402c30 <main>:
  402c30:       48 83 ec 28             sub    $0x28,%rsp
  402c34:       e8 d7 e9 ff ff          callq  401610 <__main>
  402c39:       90                      nop
  402c3a:       48 83 c4 28             add    $0x28,%rsp
402c3e: e9 0d e9 ff ff jmpq 401550 <foo> # 'foo' is not inlined

Note that 'foo' is not inlined because the archived object files weren't processed by LTO (they were processed by the linker as normal objects because they are "fat" LTO objects, i.e. they contain both normal object code and GCC IR).

$ x86_64-w64-mingw32-gcc -flto -O2 main.o foo.o
$ x86_64-w64-mingw32-objdump -d a.exe | grep '<main>:' -A 5
0000000000402c30 <main>:
  402c30:       48 83 ec 28             sub    $0x28,%rsp
  402c34:       e8 d7 e9 ff ff          callq  401610 <__main>
402c39: b8 2a 00 00 00 mov $0x2a,%eax # Good, 'foo' is inlined!
  402c3e:       48 83 c4 28             add    $0x28,%rsp
  402c42:       c3                      retq

In this case, legacy LTO implementation was used: GCC driver looked at the objects and called its 'lto-wrapper' helper. But it can't do that with archives.

This misconfiguration is caused by the incorrect use of '--with-plugin-ld' GCC configure option (or its strange behavior, depending on how you look at it):

$ x86_64-w64-mingw32-gcc -v
Using built-in specs.
COLLECT_GCC=x86_64-w64-mingw32-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-w64-mingw32/8.3-win32/lto-wrapper
Target: x86_64-w64-mingw32
Configured with: ../../src/configure --build=x86_64-linux-gnu --prefix=/usr --includedir='/usr/include' --mandir='/usr/share/man' --infodir='/usr/share/info' --sysconfdir=/etc --localstatedir=/var --disable-silent-rules --libdir='/usr/lib/x86_64-linux-gnu' --libexecdir='/usr/lib/x86_64-linux-gnu' --disable-maintainer-mode --disable-dependency-tracking --prefix=/usr --enable-shared --enable-static --disable-multilib --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --libdir=/usr/lib --enable-libstdcxx-time=yes --with-tune=generic --with-headers=/usr/x86_64-w64-mingw32/include --enable-version-specific-runtime-libs --enable-fully-dynamic-string --enable-libgomp --enable-languages=c,c++,fortran,objc,obj-c++,ada --enable-lto --with-plugin-ld --enable-threads=win32 --program-suffix=-win32 --program-prefix=x86_64-w64-mingw32- --target=x86_64-w64-mingw32 --with-as=/usr/bin/x86_64-w64-mingw32-as --with-ld=/usr/bin/x86_64-w64-mingw32-ld --enable-libatomic --enable-libstdcxx-filesystem-ts=yes
Thread model: win32
gcc version 8.3-win32 20190406 (GCC)

The problem is that "--with-plugin-ld" expects a linker path as the value, but if it's not given, the value becomes 'yes' and is then tested for plugin support, without much success (lookup "checking linker plugin support" in "https://buildd.debian.org/status/fetch.php?pkg=gcc-mingw-w64&arch=amd64&ver=21.2&stamp=1555227419&raw=0";).

This option is actually not needed since there is no need to use an "alternative" linker for plugins: the one that is passed with "--with-ld" will do. I've checked manually that if I remove "--with-plugin-ld" from the configuration of gcc-mingw-w64 source package, the linker plugin support is detected properly.

Ubuntu packages are also affected by this problem. I've checked that OpenSUSE Tumbleweed packages are not affected (they don't use "--with-plugin-ld").

I suggest to remove "--with-plugin-ld" from GCC configuration options.

Thanks!

-Alexey

--- End Message ---
--- Begin Message ---
Source: gcc-mingw-w64
Source-Version: 21.3

We believe that the bug you reported is fixed in the latest version of
gcc-mingw-w64, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 928...@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Stephen Kitt <sk...@debian.org> (supplier of updated gcc-mingw-w64 package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmas...@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Tue, 18 Jun 2019 08:59:34 +0200
Source: gcc-mingw-w64
Binary: gcc-mingw-w64 gcc-mingw-w64-i686 gcc-mingw-w64-x86-64 g++-mingw-w64 
g++-mingw-w64-i686 g++-mingw-w64-x86-64 gfortran-mingw-w64 
gfortran-mingw-w64-i686 gfortran-mingw-w64-x86-64 gobjc-mingw-w64 
gobjc-mingw-w64-i686 gobjc-mingw-w64-x86-64 gobjc++-mingw-w64 
gobjc++-mingw-w64-i686 gobjc++-mingw-w64-x86-64 gnat-mingw-w64 
gnat-mingw-w64-i686 gnat-mingw-w64-x86-64 gcc-mingw-w64-base
Architecture: source
Version: 21.3
Distribution: unstable
Urgency: medium
Maintainer: Stephen Kitt <sk...@debian.org>
Changed-By: Stephen Kitt <sk...@debian.org>
Description:
 g++-mingw-w64 - GNU C++ compiler for MinGW-w64
 g++-mingw-w64-i686 - GNU C++ compiler for MinGW-w64 targeting Win32
 g++-mingw-w64-x86-64 - GNU C++ compiler for MinGW-w64 targeting Win64
 gcc-mingw-w64 - GNU C compiler for MinGW-w64
 gcc-mingw-w64-base - GNU Compiler Collection for MinGW-w64 (base package)
 gcc-mingw-w64-i686 - GNU C compiler for MinGW-w64 targeting Win32
 gcc-mingw-w64-x86-64 - GNU C compiler for MinGW-w64 targeting Win64
 gfortran-mingw-w64 - GNU Fortran compiler for MinGW-w64
 gfortran-mingw-w64-i686 - GNU Fortran compiler for MinGW-w64 targeting Win32
 gfortran-mingw-w64-x86-64 - GNU Fortran compiler for MinGW-w64 targeting Win64
 gnat-mingw-w64 - GNU Ada compiler for MinGW-w64
 gnat-mingw-w64-i686 - GNU Ada compiler for MinGW-w64 targeting Win32
 gnat-mingw-w64-x86-64 - GNU Ada compiler for MinGW-w64 targeting Win64
 gobjc++-mingw-w64 - GNU Objective-C++ compiler for MinGW-w64
 gobjc++-mingw-w64-i686 - GNU Objective-C++ compiler for MinGW-w64 targeting 
Win32
 gobjc++-mingw-w64-x86-64 - GNU Objective-C++ compiler for MinGW-w64 targeting 
Win64
 gobjc-mingw-w64 - GNU Objective-C compiler for MinGW-w64
 gobjc-mingw-w64-i686 - GNU Objective-C compiler for MinGW-w64 targeting Win32
 gobjc-mingw-w64-x86-64 - GNU Objective-C compiler for MinGW-w64 targeting Win64
Closes: 928214
Changes:
 gcc-mingw-w64 (21.3) unstable; urgency=medium
 .
   * Configure LTO support correctly; thanks Alexey Izbyshev!
     Closes: #928214.
Checksums-Sha1:
 9eb88232b98d39ba8b92e1f8b3ee4390bf0db162 3426 gcc-mingw-w64_21.3.dsc
 8ff15a55912217816e01aebca9ed6937344f0082 57640 gcc-mingw-w64_21.3.tar.xz
 93c1bb788489b1e5a5ec4264a6db7b34a35bfbc2 7644 
gcc-mingw-w64_21.3_source.buildinfo
Checksums-Sha256:
 bfa0b5e5dcc879ceb003f12e674424ae41055ba6f7ab112e5beccb1281ef8209 3426 
gcc-mingw-w64_21.3.dsc
 3cb2406bc7df59130af0c022389f2889311e7497d85da12cdb92c02842393868 57640 
gcc-mingw-w64_21.3.tar.xz
 2dbd71ca935f9bbc94d26a87406e3535d535ac4641e46313ab5c05a72ec70a5f 7644 
gcc-mingw-w64_21.3_source.buildinfo
Files:
 6f641ec2944fe9ef130f253b1955a3c6 3426 devel optional gcc-mingw-w64_21.3.dsc
 ad5c7ad3c2d8cb400ad63f04cee16ac6 57640 devel optional gcc-mingw-w64_21.3.tar.xz
 61b0a42b2b5b6abeabc2318b6fab3c5c 7644 devel optional 
gcc-mingw-w64_21.3_source.buildinfo

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEnPVX/hPLkMoq7x0ggNMC9Yhtg5wFAl0IjHwACgkQgNMC9Yht
g5yFFQ//cQynbrAKxjY2GDGIUbugdbxsYwgdLYTvJ6nsbS8fyCy+QWra6lcQDy9k
QtTDlNZ0efP298z8Du8uRgUG0yV2m7io1ZYtTo3xFnAotUnaxpm6bUlGjo8DFr0M
n13F+SsH/Gaw3XKIG8ZFfP0zUcYztZttEGJcIv/n4UwXwYpplf2rxkQzuXrsGP0t
WSUFpISn3ZkDMeFD4FPi7JsP3ByGWaiXTXPuyr+ByyH60gpj78tJU8thk49JxSQB
ilclkNJJY509wo820kthxSV1RUONgL7U2XM1xTaGU6czcyoQQ08pH8P1e+B6HVmc
5QNyETb80nBNTn/K+u6LKUSA9jmceYnf9Z+P2Kv9PBCiTvyaqgpbuh6qXH7vYhP3
rSZWcwNKP8hxplhreA+7Ygv5Y/NjPcnKd3OGhs30ZNqimwPHrcicVv38lDvckVev
fDZpUJJ4H1NZgaMa3iVKXsrakrqAqV2x/jwGlVlHgqtFhd9T+nvYNDhgXLa+h7BO
1FkW6xszlntg535KmqGbHc/jJ1BDyaL/PQYCBMdIIAjJ2fN+fjJEAdMOmbeUPQpn
rlUMLgUGddnnV0iYplFpygbpbDHRRIAArRQAX7PS+sPjZzVsMsv0leb6EmaHkcWX
bBKDMq2Yn81N60+kbjIPAVp31b/rOprQZR98ZSHf4j6RvTPNmU4=
=cQY3
-----END PGP SIGNATURE-----

--- End Message ---

Reply via email to