Hi Toon,
During the GNU Tools Cauldron we discussed (at the BoF: IPA & LTO) the
possibility (and hazards) of building the run time libraries for various
compilers with -flto, enabling an -flto -static linking of programs with
the run time library available during link time optimizations.
This would be a big win for libgfortran, especially the array functions,
knowing that stride==1 can be a _big_ win for optimization. This is
why LTO is such an excellent idea for Fortran in general, and for the
library in particular.
There is a PR on this with quite some discussion already,
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77278 .
I've put you in CC of that bug, maybe we can discuss there more
in detail.
One point about the array functions: In the library, we use sort of a
ripple carry algorithm to step through the arrays. This saves space
an is general, but the performance (esp for the most common one-and
two-dimensional arrays) can suffer.
[...]
The full question of "lto-ing" run time libraries is more complicated
than just "whether it works" as those who attended the BoF will recall.
I didn't attend the Cauldron (but that discussion would have been
very interesting). I think for libgfortran, a first step would be
additional work to get declarations on both sides to agree (which is
worth doing anyway).
Best regards
Thomas