This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [texi, LTO]: Mention that -flto and -fwhole-program can be used simultaneously


Diego Novillo wrote:

On Mon, Oct 5, 2009 at 13:54, Toon Moene <toon@moene.org> wrote:

Is that right ?  All Fortran programs depend on libc (because the fortran
run-time library depends on it), so without -static, they would depend on a
shared library.

Strictly speaking, operating in whole-program mode can get you in trouble unless you are in a completely hermetic environment. I think our implementation of -fwhole-program is not as extreme as that. Honza (CC'd) will know more about it, though.

Well, one can never prove that it will work in all cases, but apparently given a random example from the repository of programs that I picked up during my g77 debugging days:


[split file in its constituent main program / subroutines]

$ ls -l *.f
-rw-r--r-- 1 toon toon  526 2009-10-05 22:53 10.f
-rw-r--r-- 1 toon toon 1187 2009-10-05 22:53 11.f
-rw-r--r-- 1 toon toon 2190 2009-10-05 22:53 12.f
-rw-r--r-- 1 toon toon 4472 2009-10-05 22:49 1.f
-rw-r--r-- 1 toon toon 2332 2009-10-05 22:50 2.f
-rw-r--r-- 1 toon toon  857 2009-10-05 22:50 3.f
-rw-r--r-- 1 toon toon 1040 2009-10-05 22:51 4.f
-rw-r--r-- 1 toon toon  920 2009-10-05 22:51 5.f
-rw-r--r-- 1 toon toon 3911 2009-10-05 22:51 6.f
-rw-r--r-- 1 toon toon 2196 2009-10-05 22:52 7.f
-rw-r--r-- 1 toon toon  858 2009-10-05 22:52 8.f
-rw-r--r-- 1 toon toon  858 2009-10-05 22:52 9.f
$ /usr/snp/bin/gfortran -c -flto -O3 *.f
$ /usr/snp/bin/gfortran -flto -O3 -fwhole-program *.o
$ export LD_LIBRARY_PATH=/usr/snp/lib64
$ ./a.out
 Solveur Lineaire Parmi : sor,jacobi,zebra,djaco ?
sor
           1   0.0000000000000000        1599.9999523162853
           2   144.44883241399251        583.56044982908224
           3   150.00408700100763        184.08001192562597
           4   146.12080277556458        88.138000543831367
           5   139.45168118840945        49.992927009958294
           6   130.89842749350692        36.395589271287690
           7   122.24945319578967        33.722054758629156
           8   114.44252153925709        31.001208673372503
           9   107.05260465373522        29.455151467454868
          10   100.13790600588800        27.903177262923691

which is the same behavior as with a normal compile of the original all-in-one-source-file version that I have.

--
Toon Moene - e-mail: toon@moene.org - phone: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
At home: http://moene.org/~toon/
Progress of GNU Fortran: http://gcc.gnu.org/gcc-4.5/changes.html


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]