public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* static libgfortran linker warnings
@ 2021-04-21  6:34 NightStrike
  2021-04-21  8:59 ` Bernhard Reutner-Fischer
  0 siblings, 1 reply; 7+ messages in thread
From: NightStrike @ 2021-04-21  6:34 UTC (permalink / raw)
  To: fortran

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?

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

* Re: static libgfortran linker warnings
  2021-04-21  6:34 static libgfortran linker warnings NightStrike
@ 2021-04-21  8:59 ` Bernhard Reutner-Fischer
  2021-04-21  9:29   ` NightStrike
  0 siblings, 1 reply; 7+ messages in thread
From: Bernhard Reutner-Fischer @ 2021-04-21  8:59 UTC (permalink / raw)
  To: NightStrike via Fortran

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?

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

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

* Re: static libgfortran linker warnings
  2021-04-21  8:59 ` Bernhard Reutner-Fischer
@ 2021-04-21  9:29   ` NightStrike
  2021-04-21 10:06     ` Bernhard Reutner-Fischer
  2021-04-21 10:16     ` Tobias Burnus
  0 siblings, 2 replies; 7+ messages in thread
From: NightStrike @ 2021-04-21  9:29 UTC (permalink / raw)
  To: Bernhard Reutner-Fischer; +Cc: NightStrike via Fortran

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.

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

* Re: static libgfortran linker warnings
  2021-04-21  9:29   ` NightStrike
@ 2021-04-21 10:06     ` Bernhard Reutner-Fischer
  2021-04-21 21:24       ` NightStrike
  2021-04-21 10:16     ` Tobias Burnus
  1 sibling, 1 reply; 7+ messages in thread
From: Bernhard Reutner-Fischer @ 2021-04-21 10:06 UTC (permalink / raw)
  To: NightStrike; +Cc: rep.dot.nop, NightStrike via Fortran

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,

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

* Re: static libgfortran linker warnings
  2021-04-21  9:29   ` NightStrike
  2021-04-21 10:06     ` Bernhard Reutner-Fischer
@ 2021-04-21 10:16     ` Tobias Burnus
  2021-04-21 21:34       ` NightStrike
  1 sibling, 1 reply; 7+ messages in thread
From: Tobias Burnus @ 2021-04-21 10:16 UTC (permalink / raw)
  To: NightStrike; +Cc: fortran, Bernhard Reutner-Fischer


>> 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.

libgfortran/acinclude.m4 contains:

     dnl Check whether -Wl,--as-needed resp. -Wl,-zignore is supported

That's where -z could come from. – Could you check what is in the
installed file libgfortran.spec? On my Linux, it has:

%{static-libgfortran:--as-needed}

If you have a '-z ignore' there, it would be interesting to understand
why – and what 'libgfortran/config.log' shows.

>> Which linker do you use, on which OS?
> binutils 2.32 (stock build from source) on CentOS 7.

Here: Ubuntu with binutils 2.34.

Tobias

-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 München Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Frank Thürauf

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

* Re: static libgfortran linker warnings
  2021-04-21 10:06     ` Bernhard Reutner-Fischer
@ 2021-04-21 21:24       ` NightStrike
  0 siblings, 0 replies; 7+ messages in thread
From: NightStrike @ 2021-04-21 21:24 UTC (permalink / raw)
  To: Bernhard Reutner-Fischer; +Cc: NightStrike via Fortran

On Wed, Apr 21, 2021 at 6:06 AM Bernhard Reutner-Fischer
<rep.dot.nop@gmail.com> wrote:
>
> 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,

FWIW:

./ld: supported targets: elf64-x86-64 elf32-i386 elf32-iamcu
elf32-x86-64 pei-i386 pei-x86-64 elf64-l1om elf64-k1om elf64-little
elf64-big elf32-little elf32-big plugin srec symbolsrec verilog tekhex
binary ihex
./ld: supported emulations: elf_x86_64 elf32_x86_64 elf_i386 elf_iamcu
elf_l1om elf_k1om
./ld: emulation specific options:

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

* Re: static libgfortran linker warnings
  2021-04-21 10:16     ` Tobias Burnus
@ 2021-04-21 21:34       ` NightStrike
  0 siblings, 0 replies; 7+ messages in thread
From: NightStrike @ 2021-04-21 21:34 UTC (permalink / raw)
  To: Tobias Burnus; +Cc: fortran, Bernhard Reutner-Fischer

On Wed, Apr 21, 2021 at 6:17 AM Tobias Burnus <tobias@codesourcery.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.
>
> libgfortran/acinclude.m4 contains:
>
>      dnl Check whether -Wl,--as-needed resp. -Wl,-zignore is supported
>
> That's where -z could come from. – Could you check what is in the
> installed file libgfortran.spec? On my Linux, it has:
>
> %{static-libgfortran:--as-needed}
>
> If you have a '-z ignore' there, it would be interesting to understand
> why – and what 'libgfortran/config.log' shows.
>
> >> Which linker do you use, on which OS?
> > binutils 2.32 (stock build from source) on CentOS 7.
>
> Here: Ubuntu with binutils 2.34.

%rename lib liborig

*lib: %{static-libgfortran:-zignore} -lquadmath
%{static-libgfortran:-zrecord} -lm %(libgcc) %(liborig)

Clearly, I built it wrong.  I just would like to know how I did so.

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

end of thread, other threads:[~2021-04-21 21:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-21  6:34 static libgfortran linker warnings NightStrike
2021-04-21  8:59 ` Bernhard Reutner-Fischer
2021-04-21  9:29   ` NightStrike
2021-04-21 10:06     ` Bernhard Reutner-Fischer
2021-04-21 21:24       ` NightStrike
2021-04-21 10:16     ` Tobias Burnus
2021-04-21 21:34       ` NightStrike

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).