Your message dated Thu, 20 Jun 2019 16:34:01 +0000
with message-id <[email protected]>
and subject line Bug#928214: fixed in gcc-mingw-w64 21.3~deb10u1
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 [email protected]
immediately.)


-- 
928214: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=928214
Debian Bug Tracking System
Contact [email protected] 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~deb10u1

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 [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Stephen Kitt <[email protected]> (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 [email protected])


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

Format: 1.8
Date: Thu, 20 Jun 2019 18:07:46 +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~deb10u1
Distribution: buster
Urgency: medium
Maintainer: Stephen Kitt <[email protected]>
Changed-By: Stephen Kitt <[email protected]>
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~deb10u1) buster; urgency=medium
 .
   * Upload to Buster.
 .
 gcc-mingw-w64 (21.3) unstable; urgency=medium
 .
   * Configure LTO support correctly; thanks Alexey Izbyshev!
     Closes: #928214.
Checksums-Sha1:
 5ab06bf45efd2f6dc5b362c56e7dce799cd8c1c9 3458 gcc-mingw-w64_21.3~deb10u1.dsc
 b48d94c15560e087798e8e0cc34cb75d22d3a0f9 57668 
gcc-mingw-w64_21.3~deb10u1.tar.xz
 3af561f689f080ac5480d4452759be22a462aac6 7806 
gcc-mingw-w64_21.3~deb10u1_source.buildinfo
Checksums-Sha256:
 9e87ae2f84adab10c082d1228278610feddf52cb403d348ebae521df1cb25b74 3458 
gcc-mingw-w64_21.3~deb10u1.dsc
 93fd50df71480555bda507ab777681e6b57996d9ffeb39d594bcecc7a88c5131 57668 
gcc-mingw-w64_21.3~deb10u1.tar.xz
 f51eb4d388588e25921f8503eee78487fc1ebb18862786d172c1957b508e360f 7806 
gcc-mingw-w64_21.3~deb10u1_source.buildinfo
Files:
 9f34a4f36df3eff880dd42040bb465bb 3458 devel optional 
gcc-mingw-w64_21.3~deb10u1.dsc
 e85c5079e37244214087b6fc7867a287 57668 devel optional 
gcc-mingw-w64_21.3~deb10u1.tar.xz
 8297187fb2579c9a03d6eb2fdd95387c 7806 devel optional 
gcc-mingw-w64_21.3~deb10u1_source.buildinfo

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

iQIzBAEBCgAdFiEEnPVX/hPLkMoq7x0ggNMC9Yhtg5wFAl0Lr4kACgkQgNMC9Yht
g5xx8Q//RK9RmQEbxQYDcyobMI+o31/ji09G6gC3U6sIQnzmwXdjv7CYikxHWjrE
VbgrrL66dbrS+c5ho8X/Okg2aryRwKhlS/1/CnbcxJrcMko3fs7sIOq70Gf5w2E/
AIVsNSDr7sP1V6mIOpg4khMixVk8sDQDu6AxiZMANGt79vH83JvTHo93GBN26mf1
GxsGBzSXgSfP67yuMQd95YeICXYuIFYBJ/YX83a9H9hgdR06Y44C6QWUrtoUJzGG
5fuiSCGIlvZwTaRSG7tQmnVGeJxNcXJHNFyNPfZbVF/BD+mXcg2t+OmYZEaT6Ff2
2i1GGbt5Yfhb1WyE94H3AGw8jiSXWa5oiOpFJZRMO+mEn7K1SlUuRU6HGEEVH3Q2
J/azbvbs3D3TUscGDLSvSEfGmBobqd40AzVzJa32OzTjy3gdeJRR5BobdyIExOtz
TcLOxXZujd8aRoxYcBou3DH3gFYfzcvguArpVxlyBBAApoTn4g6BYdku+7SPfBq9
UVPgCXhcjWzHB3tB2QeZVfVpSkF20HUjhS5LJwOzfWe4qcmV22enU1oRztgneQyS
jcwSMSMgG50jL69aCJviT4yh4pkf3++4Qw05TIMeJLA+qduPA+Gmc+iC6Yb6u/h8
U4yIGBjRt7yy2Qlad/YgjRh4kvb/Rvob71q4+pNqUc24RCh76cM=
=koQA
-----END PGP SIGNATURE-----

--- End Message ---

Reply via email to