static libgfortran linker warnings

Bernhard Reutner-Fischer rep.dot.nop@gmail.com
Wed Apr 21 10:06:24 GMT 2021


On Wed, 21 Apr 2021 05:29:28 -0400
NightStrike <nightstrike@gmail.com> wrote:

> On Wed, Apr 21, 2021 at 4:59 AM Bernhard Reutner-Fischer
> <rep.dot.nop@gmail.com> wrote:
> > On Wed, 21 Apr 2021 02:34:43 -0400
> > NightStrike via Fortran <fortran@gcc.gnu.org> wrote:
> >  
> > > When linking with -static-libgfortran, I get warnings from ld of the form
> > > "ld: warning: -z ignore ignored" and "ld: warning: -z record ignored". I
> > > can't find those -z options documented anywhere.  Why is gfortran adding
> > > them?  
> >
> > -z are options to ld.
> > Which linker do you use, on which OS?  
> 
> binutils 2.32 (stock build from source) on CentOS 7.
> 
> > If you use binutils, you can pass -Wl,--verbose to the compiler to
> > instruct the linker to dump the linker script while linking. This should
> > show where the -z comes from:
> > gfortran foo.f90 -static-libgfortran -Wl,--verbose  
> 
> I didn't do this per se, but I did gfortran -v, and saw that it was an
> option to collect2.  I can try your method when the system is
> available again tomorrow.

gcc/configure.ac suggests that -z ignore / -z record is the native
solaris ld parlance for --as-needed / --no-as-needed
See "AC_CACHE_CHECK(linker --as-needed support".

No idea why your gcc build thought that the ignore/record tuple is the
correct thing to use for as-needed/no-as-needed. Maybe check your
config.log around the '--as-needed support' checks for clues.

I wouldn't suggest to hand edit your libgfortran.spec to use
*lib: %{static-libgfortran:--as-needed} -lquadmath %{static-libgfortran:--no-as-needed} -lm %(libgcc) %(liborig)
but i guess that would silence your linker warnings, too.
HTH,


More information about the Fortran mailing list