public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/96752] New: -fwhopr feature - is it available in gcc 9.2.0
@ 2020-08-23 12:54 djuki.car.kv at gmail dot com
  2020-08-23 12:54 ` [Bug lto/96752] " djuki.car.kv at gmail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: djuki.car.kv at gmail dot com @ 2020-08-23 12:54 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96752

            Bug ID: 96752
           Summary: -fwhopr feature - is it available in gcc 9.2.0
           Product: gcc
           Version: 9.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: djuki.car.kv at gmail dot com
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

Created attachment 49104
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49104&action=edit
Patch for LTO during building gcc in MinGW

Dear GCC team,

I was very curious to explore Link-Time-Optimization in a GCC and I though it
can improve my project. I found that during linking I also need to provide the
same option which I have used during compiling. And it makes sense. But I can't
use standard LTO because my project contains C and CPP files which is compiled
with different configuration flags. So Linker complains every time when I try
to build my project. After that I found that instead of LTO, I can use Whole
Program  Optimization (-fwhopr). From my point of view, it will really solve my
problem, because the compiler will do all optimization during compiling and at
the end it will just link object files. Please look at the image which I found
in the GCC documentation.

But when I tried to compile just simple project with flag -fwhopr, the compiler
complained that -fwhopr is unknown option for its. Is this feature still part
of GCC? Maybe I didn't build my compiler well. The configuration which I have
used is:

$SRCDIR/configure --host=$host --build=$build --prefix=$prefix --target=$target
--disable-nls --enable-multilib --with-multilib-list=lp64,ilp32
--enable-languages=c,c++ --disable-decimal-float --with-sysroot=$prefix
--without-headers --disable-shared --disable-threads --enable-lto
--enable-plugin --disable-libmudflap --disable-libssp --disable-libgomp
--disable-libffi --disable-libstdcxx-pch --disable-win32-registry
'--with-host-libstdcxx=-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm'
--with-newlib --with-gcc --with-gnu-as --with-gnu-ld --with-gmp=$prefixlocal
--with-mpfr=$prefixlocal --with-mpc=$prefixlocal --with-isl=$prefixlocal
--with-zstd=$prefixlocal

But before configuration, you will need to apply the patch, which you can find
in attachment. This is only if you want to build it in Windows 10 using  MinGW
9.2.0. On Linux Debian 10, I think everything is working as expected. I have
tried to build gcc for aarch64, but I think for all other targets it is the
same.

Also, you have noticed I use ld.bfd instead ld.gold. Generally LTO is related
to the gold linker, but I found information that BFD linker also supports LTO.
I had some issues when I tried to use gold linker. I was able to compile my
project, but it didn't work. I didn't have a time to investigate more in it,
but I saw memory sections look different although I used the same linker
script. For this reason, I have tried to use BFD linker for LTO. 

Thanks for considering this message and I hope you will have some solution for
Whole Program Optimization option. Please let me know if I can assist any
further.

With best regards,
M.Eng. Filip Bascarevic

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug lto/96752] -fwhopr feature - is it available in gcc 9.2.0
  2020-08-23 12:54 [Bug lto/96752] New: -fwhopr feature - is it available in gcc 9.2.0 djuki.car.kv at gmail dot com
@ 2020-08-23 12:54 ` djuki.car.kv at gmail dot com
  2020-08-23 16:31 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: djuki.car.kv at gmail dot com @ 2020-08-23 12:54 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96752

--- Comment #1 from Djuki Bascarevic <djuki.car.kv at gmail dot com> ---
Created attachment 49105
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49105&action=edit
WHOPR diagram

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug lto/96752] -fwhopr feature - is it available in gcc 9.2.0
  2020-08-23 12:54 [Bug lto/96752] New: -fwhopr feature - is it available in gcc 9.2.0 djuki.car.kv at gmail dot com
  2020-08-23 12:54 ` [Bug lto/96752] " djuki.car.kv at gmail dot com
@ 2020-08-23 16:31 ` pinskia at gcc dot gnu.org
  2020-08-24  7:27 ` marxin at gcc dot gnu.org
  2020-08-25 11:41 ` rguenth at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2020-08-23 16:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96752

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
> But I can't use standard LTO because my project contains C and CPP files which is compiled with different configuration flags.

That should not matter in new enough GCCs as GCC record the options per
function these days.

whopr mode is default in GCC 9.x and above and you don't need a special option
to enable it.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug lto/96752] -fwhopr feature - is it available in gcc 9.2.0
  2020-08-23 12:54 [Bug lto/96752] New: -fwhopr feature - is it available in gcc 9.2.0 djuki.car.kv at gmail dot com
  2020-08-23 12:54 ` [Bug lto/96752] " djuki.car.kv at gmail dot com
  2020-08-23 16:31 ` pinskia at gcc dot gnu.org
@ 2020-08-24  7:27 ` marxin at gcc dot gnu.org
  2020-08-25 11:41 ` rguenth at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-08-24  7:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96752

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2020-08-24

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
> I was very curious to explore Link-Time-Optimization in a GCC and I though
> it can improve my project. I found that during linking I also need to
> provide the same option which I have used during compiling.

That's not needed. LTO streams options per-function basis and similarly for
GCC's --param options. It's commonly used technique to mix various options
during build of a project (like Firefox).

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug lto/96752] -fwhopr feature - is it available in gcc 9.2.0
  2020-08-23 12:54 [Bug lto/96752] New: -fwhopr feature - is it available in gcc 9.2.0 djuki.car.kv at gmail dot com
                   ` (2 preceding siblings ...)
  2020-08-24  7:27 ` marxin at gcc dot gnu.org
@ 2020-08-25 11:41 ` rguenth at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-08-25 11:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96752

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|---                         |INVALID

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
There is no -fwhopr flag.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-08-25 11:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-23 12:54 [Bug lto/96752] New: -fwhopr feature - is it available in gcc 9.2.0 djuki.car.kv at gmail dot com
2020-08-23 12:54 ` [Bug lto/96752] " djuki.car.kv at gmail dot com
2020-08-23 16:31 ` pinskia at gcc dot gnu.org
2020-08-24  7:27 ` marxin at gcc dot gnu.org
2020-08-25 11:41 ` rguenth at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).