public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* is there a way to find out gfortran version and/or options from a given binary?
@ 2022-06-01  8:42 Kay Diederichs
  2022-06-01  9:30 ` Arjen Markus
  0 siblings, 1 reply; 19+ messages in thread
From: Kay Diederichs @ 2022-06-01  8:42 UTC (permalink / raw)
  To: fortran

Hi,

is there any gfortran option and/or version information available from/in a binary? Maybe accessible with objdump or strings?

For ifort, we use the -sox option ("This option tells the compiler to save the compilation options and version number in the executable file. ..."). This enables e.g.
strings /path/to/binary | grep Intel

Or is there a gfortran option that makes this accessible in a binary?

Thanks,
Kay



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

* Re: is there a way to find out gfortran version and/or options from a given binary?
  2022-06-01  8:42 is there a way to find out gfortran version and/or options from a given binary? Kay Diederichs
@ 2022-06-01  9:30 ` Arjen Markus
  2022-06-01  9:41   ` Kay Diederichs
  0 siblings, 1 reply; 19+ messages in thread
From: Arjen Markus @ 2022-06-01  9:30 UTC (permalink / raw)
  To: Kay Diederichs; +Cc: Fortran List

Are you perhaps looking for the compiler_version() and compiler_options()
functions? I use them like this, they were defined in Fortran 2008 if I am
not mistaken:


                WRITE( lurep, '(a)' ) 'Report of simulation'
                WRITE( lurep, '(a)' ) '--------------------'
                WRITE( lurep, '(a)' ) 'Compiler version: ',
compiler_version()
                WRITE( lurep, '(a)' ) 'Compiler options: ',
compiler_options()

Regards,

Arjen

Op wo 1 jun. 2022 om 10:42 schreef Kay Diederichs <
kay.diederichs@uni-konstanz.de>:

> Hi,
>
> is there any gfortran option and/or version information available from/in
> a binary? Maybe accessible with objdump or strings?
>
> For ifort, we use the -sox option ("This option tells the compiler to save
> the compilation options and version number in the executable file. ...").
> This enables e.g.
> strings /path/to/binary | grep Intel
>
> Or is there a gfortran option that makes this accessible in a binary?
>
> Thanks,
> Kay
>
>
>

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

* Re: is there a way to find out gfortran version and/or options from a given binary?
  2022-06-01  9:30 ` Arjen Markus
@ 2022-06-01  9:41   ` Kay Diederichs
  2022-06-01  9:50     ` Andre Vehreschild
  0 siblings, 1 reply; 19+ messages in thread
From: Kay Diederichs @ 2022-06-01  9:41 UTC (permalink / raw)
  To: Arjen Markus; +Cc: Fortran List

[-- Attachment #1: Type: text/plain, Size: 1990 bytes --]

Hi Arjen,

thanks for your answer. I do know about these functions, and use them in my own programs if appropriate. However, programs
distributed to others for production use should not output this because it confuses users (as does "Note: The following floating-point exceptions are signalling: IEEE_INVALID_FLAG" which I need to switch off with -ffpe-summary=none).

So I really am looking for strings or other type of info in the binary.

Best wishes,
Kay

On 6/1/22 11:30, Arjen Markus wrote:
> Are you perhaps looking for the compiler_version() and compiler_options() functions? I use them like this, they were defined in Fortran 2008 if I am not mistaken:
> 
> 
>                  WRITE( lurep, '(a)' ) 'Report of simulation'
>                  WRITE( lurep, '(a)' ) '--------------------'
>                  WRITE( lurep, '(a)' ) 'Compiler version: ', compiler_version()
>                  WRITE( lurep, '(a)' ) 'Compiler options: ', compiler_options()
> 
> Regards,
> 
> Arjen
> 
> Op wo 1 jun. 2022 om 10:42 schreef Kay Diederichs <kay.diederichs@uni-konstanz.de <mailto:kay.diederichs@uni-konstanz.de>>:
> 
>     Hi,
> 
>     is there any gfortran option and/or version information available from/in a binary? Maybe accessible with objdump or strings?
> 
>     For ifort, we use the -sox option ("This option tells the compiler to save the compilation options and version number in the executable file. ..."). This enables e.g.
>     strings /path/to/binary | grep Intel
> 
>     Or is there a gfortran option that makes this accessible in a binary?
> 
>     Thanks,
>     Kay
> 
> 

-- 
Kay Diederichs                http://strucbio.biologie.uni-konstanz.de
email: Kay.Diederichs@uni-konstanz.de             Tel +49 7531 88 4049
Fachbereich Biologie, Universität Konstanz, Box M647, D-78457 Konstanz

This e-mail is digitally signed. If your e-mail client does not have the
necessary capabilities, just ignore the attached signature "smime.p7s".

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 5905 bytes --]

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

* Re: is there a way to find out gfortran version and/or options from a given binary?
  2022-06-01  9:41   ` Kay Diederichs
@ 2022-06-01  9:50     ` Andre Vehreschild
  2022-06-01  9:53       ` Arjen Markus
  0 siblings, 1 reply; 19+ messages in thread
From: Andre Vehreschild @ 2022-06-01  9:50 UTC (permalink / raw)
  To: Kay Diederichs; +Cc: Fortran List

Hi Kay,

did you try:

$ strings coarray_collectives_18 | grep  GNU
GCC: (GNU) 11.2.1 20211203 (Red Hat 11.2.1-7)
GCC: (GNU) 12.0.1 20220214 (experimental)
GNU Fortran2008 12.0.1 20220214 (experimental) -mtune=generic -march=x86-64 -g
-fcoarray=lib -fintrinsic-modules-path
/home/vehre/Projekte/gcc/gfortran/lib/gcc/x86_64-pc-linux-gnu/12.0.1/finclude
-fpre-include=/usr/include/finclude/math-vector-fortran.h GNU C11 12.0.1
20220214 (experimental) -mshstk -mtune=generic -march=x86-64 -g -O2 -O0
-std=gnu11 -fcf-protection=full -fcx-fortran-rules -ffunction-sections
-fdata-sections __GNU_EH_FRAME_HDR

or

strings coarray_collectives_18 | grep GCC

...
? 

Both give me some output (albeit more than I desire) for an executable compiled
with gfortran. But presumably, I had activated debug. I don't know, if
optimized builds will have it, too.

Regards,
	Andre

On Wed, 1 Jun 2022 11:41:41 +0200
Kay Diederichs <Kay.Diederichs@uni-konstanz.de> wrote:

> Hi Arjen,
> 
> thanks for your answer. I do know about these functions, and use them in my
> own programs if appropriate. However, programs distributed to others for
> production use should not output this because it confuses users (as does
> "Note: The following floating-point exceptions are signalling:
> IEEE_INVALID_FLAG" which I need to switch off with -ffpe-summary=none).
> 
> So I really am looking for strings or other type of info in the binary.
> 
> Best wishes,
> Kay
> 
> On 6/1/22 11:30, Arjen Markus wrote:
> > Are you perhaps looking for the compiler_version() and compiler_options()
> > functions? I use them like this, they were defined in Fortran 2008 if I am
> > not mistaken:
> > 
> > 
> >                  WRITE( lurep, '(a)' ) 'Report of simulation'
> >                  WRITE( lurep, '(a)' ) '--------------------'
> >                  WRITE( lurep, '(a)' ) 'Compiler version: ',
> > compiler_version() WRITE( lurep, '(a)' ) 'Compiler options: ',
> > compiler_options()
> > 
> > Regards,
> > 
> > Arjen
> > 
> > Op wo 1 jun. 2022 om 10:42 schreef Kay Diederichs
> > <kay.diederichs@uni-konstanz.de <mailto:kay.diederichs@uni-konstanz.de>>:
> > 
> >     Hi,
> > 
> >     is there any gfortran option and/or version information available
> > from/in a binary? Maybe accessible with objdump or strings?
> > 
> >     For ifort, we use the -sox option ("This option tells the compiler to
> > save the compilation options and version number in the executable file.
> > ..."). This enables e.g. strings /path/to/binary | grep Intel
> > 
> >     Or is there a gfortran option that makes this accessible in a binary?
> > 
> >     Thanks,
> >     Kay
> > 
> >   
> 


-- 
Andre Vehreschild * Email: vehre ad gmx dot de 

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

* Re: is there a way to find out gfortran version and/or options from a given binary?
  2022-06-01  9:50     ` Andre Vehreschild
@ 2022-06-01  9:53       ` Arjen Markus
  2022-06-01 10:00         ` Arjen Markus
  0 siblings, 1 reply; 19+ messages in thread
From: Arjen Markus @ 2022-06-01  9:53 UTC (permalink / raw)
  To: Andre Vehreschild; +Cc: Kay Diederichs, Fortran List

I thought you might get this information by using these two functions in a
parameter definition, but that is not allowed, alas.

Regards,

Arjen


Op wo 1 jun. 2022 om 11:50 schreef Andre Vehreschild via Fortran <
fortran@gcc.gnu.org>:

> Hi Kay,
>
> did you try:
>
> $ strings coarray_collectives_18 | grep  GNU
> GCC: (GNU) 11.2.1 20211203 (Red Hat 11.2.1-7)
> GCC: (GNU) 12.0.1 20220214 (experimental)
> GNU Fortran2008 12.0.1 20220214 (experimental) -mtune=generic
> -march=x86-64 -g
> -fcoarray=lib -fintrinsic-modules-path
>
> /home/vehre/Projekte/gcc/gfortran/lib/gcc/x86_64-pc-linux-gnu/12.0.1/finclude
> -fpre-include=/usr/include/finclude/math-vector-fortran.h GNU C11 12.0.1
> 20220214 (experimental) -mshstk -mtune=generic -march=x86-64 -g -O2 -O0
> -std=gnu11 -fcf-protection=full -fcx-fortran-rules -ffunction-sections
> -fdata-sections __GNU_EH_FRAME_HDR
>
> or
>
> strings coarray_collectives_18 | grep GCC
>
> ...
> ?
>
> Both give me some output (albeit more than I desire) for an executable
> compiled
> with gfortran. But presumably, I had activated debug. I don't know, if
> optimized builds will have it, too.
>
> Regards,
>         Andre
>
> On Wed, 1 Jun 2022 11:41:41 +0200
> Kay Diederichs <Kay.Diederichs@uni-konstanz.de> wrote:
>
> > Hi Arjen,
> >
> > thanks for your answer. I do know about these functions, and use them in
> my
> > own programs if appropriate. However, programs distributed to others for
> > production use should not output this because it confuses users (as does
> > "Note: The following floating-point exceptions are signalling:
> > IEEE_INVALID_FLAG" which I need to switch off with -ffpe-summary=none).
> >
> > So I really am looking for strings or other type of info in the binary.
> >
> > Best wishes,
> > Kay
> >
> > On 6/1/22 11:30, Arjen Markus wrote:
> > > Are you perhaps looking for the compiler_version() and
> compiler_options()
> > > functions? I use them like this, they were defined in Fortran 2008 if
> I am
> > > not mistaken:
> > >
> > >
> > >                  WRITE( lurep, '(a)' ) 'Report of simulation'
> > >                  WRITE( lurep, '(a)' ) '--------------------'
> > >                  WRITE( lurep, '(a)' ) 'Compiler version: ',
> > > compiler_version() WRITE( lurep, '(a)' ) 'Compiler options: ',
> > > compiler_options()
> > >
> > > Regards,
> > >
> > > Arjen
> > >
> > > Op wo 1 jun. 2022 om 10:42 schreef Kay Diederichs
> > > <kay.diederichs@uni-konstanz.de <mailto:kay.diederichs@uni-konstanz.de
> >>:
> > >
> > >     Hi,
> > >
> > >     is there any gfortran option and/or version information available
> > > from/in a binary? Maybe accessible with objdump or strings?
> > >
> > >     For ifort, we use the -sox option ("This option tells the compiler
> to
> > > save the compilation options and version number in the executable file.
> > > ..."). This enables e.g. strings /path/to/binary | grep Intel
> > >
> > >     Or is there a gfortran option that makes this accessible in a
> binary?
> > >
> > >     Thanks,
> > >     Kay
> > >
> > >
> >
>
>
> --
> Andre Vehreschild * Email: vehre ad gmx dot de
>

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

* Re: is there a way to find out gfortran version and/or options from a given binary?
  2022-06-01  9:53       ` Arjen Markus
@ 2022-06-01 10:00         ` Arjen Markus
  2022-06-01 10:16           ` Kay Diederichs
  0 siblings, 1 reply; 19+ messages in thread
From: Arjen Markus @ 2022-06-01 10:00 UTC (permalink / raw)
  To: Andre Vehreschild; +Cc: Kay Diederichs, Fortran List

Well, if you call these functions in the code, the text is available in the
executable file. I used:

! staticv.f90 --
!     Static information about the compiler? Not via parameters
!
program staticv
    use iso_fortran_env

    implicit none
    character(len=200) :: c, d

    c = compiler_version()
    d = compiler_options()
    write(*,*) c(1:1), d(1:)1
end program staticv

to force the text strings to appear. I think a long character string is
required.

Regards,

Arjen

Op wo 1 jun. 2022 om 11:53 schreef Arjen Markus <arjen.markus895@gmail.com>:

> I thought you might get this information by using these two functions in a
> parameter definition, but that is not allowed, alas.
>
> Regards,
>
> Arjen
>
>
> Op wo 1 jun. 2022 om 11:50 schreef Andre Vehreschild via Fortran <
> fortran@gcc.gnu.org>:
>
>> Hi Kay,
>>
>> did you try:
>>
>> $ strings coarray_collectives_18 | grep  GNU
>> GCC: (GNU) 11.2.1 20211203 (Red Hat 11.2.1-7)
>> GCC: (GNU) 12.0.1 20220214 (experimental)
>> GNU Fortran2008 12.0.1 20220214 (experimental) -mtune=generic
>> -march=x86-64 -g
>> -fcoarray=lib -fintrinsic-modules-path
>>
>> /home/vehre/Projekte/gcc/gfortran/lib/gcc/x86_64-pc-linux-gnu/12.0.1/finclude
>> -fpre-include=/usr/include/finclude/math-vector-fortran.h GNU C11 12.0.1
>> 20220214 (experimental) -mshstk -mtune=generic -march=x86-64 -g -O2 -O0
>> -std=gnu11 -fcf-protection=full -fcx-fortran-rules -ffunction-sections
>> -fdata-sections __GNU_EH_FRAME_HDR
>>
>> or
>>
>> strings coarray_collectives_18 | grep GCC
>>
>> ...
>> ?
>>
>> Both give me some output (albeit more than I desire) for an executable
>> compiled
>> with gfortran. But presumably, I had activated debug. I don't know, if
>> optimized builds will have it, too.
>>
>> Regards,
>>         Andre
>>
>> On Wed, 1 Jun 2022 11:41:41 +0200
>> Kay Diederichs <Kay.Diederichs@uni-konstanz.de> wrote:
>>
>> > Hi Arjen,
>> >
>> > thanks for your answer. I do know about these functions, and use them
>> in my
>> > own programs if appropriate. However, programs distributed to others for
>> > production use should not output this because it confuses users (as does
>> > "Note: The following floating-point exceptions are signalling:
>> > IEEE_INVALID_FLAG" which I need to switch off with -ffpe-summary=none).
>> >
>> > So I really am looking for strings or other type of info in the binary.
>> >
>> > Best wishes,
>> > Kay
>> >
>> > On 6/1/22 11:30, Arjen Markus wrote:
>> > > Are you perhaps looking for the compiler_version() and
>> compiler_options()
>> > > functions? I use them like this, they were defined in Fortran 2008 if
>> I am
>> > > not mistaken:
>> > >
>> > >
>> > >                  WRITE( lurep, '(a)' ) 'Report of simulation'
>> > >                  WRITE( lurep, '(a)' ) '--------------------'
>> > >                  WRITE( lurep, '(a)' ) 'Compiler version: ',
>> > > compiler_version() WRITE( lurep, '(a)' ) 'Compiler options: ',
>> > > compiler_options()
>> > >
>> > > Regards,
>> > >
>> > > Arjen
>> > >
>> > > Op wo 1 jun. 2022 om 10:42 schreef Kay Diederichs
>> > > <kay.diederichs@uni-konstanz.de <mailto:
>> kay.diederichs@uni-konstanz.de>>:
>> > >
>> > >     Hi,
>> > >
>> > >     is there any gfortran option and/or version information available
>> > > from/in a binary? Maybe accessible with objdump or strings?
>> > >
>> > >     For ifort, we use the -sox option ("This option tells the
>> compiler to
>> > > save the compilation options and version number in the executable
>> file.
>> > > ..."). This enables e.g. strings /path/to/binary | grep Intel
>> > >
>> > >     Or is there a gfortran option that makes this accessible in a
>> binary?
>> > >
>> > >     Thanks,
>> > >     Kay
>> > >
>> > >
>> >
>>
>>
>> --
>> Andre Vehreschild * Email: vehre ad gmx dot de
>>
>

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

* Re: is there a way to find out gfortran version and/or options from a given binary?
  2022-06-01 10:00         ` Arjen Markus
@ 2022-06-01 10:16           ` Kay Diederichs
  2022-06-01 11:36             ` Arjen Markus
  2022-06-02 19:06             ` Janne Blomqvist
  0 siblings, 2 replies; 19+ messages in thread
From: Kay Diederichs @ 2022-06-01 10:16 UTC (permalink / raw)
  To: Arjen Markus, Andre Vehreschild; +Cc: Fortran List

[-- Attachment #1: Type: text/plain, Size: 1087 bytes --]

I tried your suggestion below, but it does not store the options unless 
the -g option is used.

If -g is used, the executable _always_ has version and option info (no 
extra code invoking compiler_version() and compiler_options() is 
needed). Just use strings <binary> | grep GNU .
If -g is not used, no option info is in the executable.

Best wishes,
Kay

On 01.06.22 12:00, Arjen Markus wrote:
> staticv.f90 --
> !     Static information about the compiler? Not via parameters
> !
> program staticv
>      use iso_fortran_env
> 
>      implicit none
>      character(len=200) :: c, d
> 
>      c = compiler_version()
>      d = compiler_options()
>      write(*,*) c(1:1), d(1:)1
> end program staticv
> 

-- 
Kay Diederichs                http://strucbio.biologie.uni-konstanz.de
email: Kay.Diederichs@uni-konstanz.de             Tel +49 7531 88 4049
Fachbereich Biologie, Universität Konstanz, Box M647, D-78457 Konstanz

This e-mail is digitally signed. If your e-mail client does not have the
necessary capabilities, just ignore the attached signature "smime.p7s".

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 5322 bytes --]

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

* Re: is there a way to find out gfortran version and/or options from a given binary?
  2022-06-01 10:16           ` Kay Diederichs
@ 2022-06-01 11:36             ` Arjen Markus
  2022-06-01 11:46               ` Arjen Markus
  2022-06-02 19:06             ` Janne Blomqvist
  1 sibling, 1 reply; 19+ messages in thread
From: Arjen Markus @ 2022-06-01 11:36 UTC (permalink / raw)
  To: Kay Diederichs; +Cc: Andre Vehreschild, Fortran List

Hm, I ran it without any options - would that be equivalent to -g then? A
rather awkward workaround might be to compile one source file containing
this code with -g, but that is pushing things to the limit.

Regards,

Arjen

Op wo 1 jun. 2022 om 12:16 schreef Kay Diederichs <
kay.diederichs@uni-konstanz.de>:

> I tried your suggestion below, but it does not store the options unless
> the -g option is used.
>
> If -g is used, the executable _always_ has version and option info (no
> extra code invoking compiler_version() and compiler_options() is
> needed). Just use strings <binary> | grep GNU .
> If -g is not used, no option info is in the executable.
>
> Best wishes,
> Kay
>
> On 01.06.22 12:00, Arjen Markus wrote:
> > staticv.f90 --
> > !     Static information about the compiler? Not via parameters
> > !
> > program staticv
> >      use iso_fortran_env
> >
> >      implicit none
> >      character(len=200) :: c, d
> >
> >      c = compiler_version()
> >      d = compiler_options()
> >      write(*,*) c(1:1), d(1:)1
> > end program staticv
> >
>
> --
> Kay Diederichs                http://strucbio.biologie.uni-konstanz.de
> email: Kay.Diederichs@uni-konstanz.de             Tel +49 7531 88 4049
> Fachbereich Biologie, Universität Konstanz, Box M647, D-78457 Konstanz
>
> This e-mail is digitally signed. If your e-mail client does not have the
> necessary capabilities, just ignore the attached signature "smime.p7s".
>

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

* Re: is there a way to find out gfortran version and/or options from a given binary?
  2022-06-01 11:36             ` Arjen Markus
@ 2022-06-01 11:46               ` Arjen Markus
  2022-06-01 12:04                 ` Kay Diederichs
  0 siblings, 1 reply; 19+ messages in thread
From: Arjen Markus @ 2022-06-01 11:46 UTC (permalink / raw)
  To: Kay Diederichs; +Cc: Andre Vehreschild, Fortran List

Are you sure that -g is the trigger? It may very well be that you need to
make sure that the optimiser does not eliminate the variable that holds the
identification. That is why I write the first character of these strings,
to make sure that the variables are retained. That could be achieved in all
manner of ways to fool the optimiser. Note that with -O2 and the program I
posted I still get the strings.

Regards,

Arjen

Op wo 1 jun. 2022 om 13:36 schreef Arjen Markus <arjen.markus895@gmail.com>:

> Hm, I ran it without any options - would that be equivalent to -g then? A
> rather awkward workaround might be to compile one source file containing
> this code with -g, but that is pushing things to the limit.
>
> Regards,
>
> Arjen
>
> Op wo 1 jun. 2022 om 12:16 schreef Kay Diederichs <
> kay.diederichs@uni-konstanz.de>:
>
>> I tried your suggestion below, but it does not store the options unless
>> the -g option is used.
>>
>> If -g is used, the executable _always_ has version and option info (no
>> extra code invoking compiler_version() and compiler_options() is
>> needed). Just use strings <binary> | grep GNU .
>> If -g is not used, no option info is in the executable.
>>
>> Best wishes,
>> Kay
>>
>> On 01.06.22 12:00, Arjen Markus wrote:
>> > staticv.f90 --
>> > !     Static information about the compiler? Not via parameters
>> > !
>> > program staticv
>> >      use iso_fortran_env
>> >
>> >      implicit none
>> >      character(len=200) :: c, d
>> >
>> >      c = compiler_version()
>> >      d = compiler_options()
>> >      write(*,*) c(1:1), d(1:)1
>> > end program staticv
>> >
>>
>> --
>> Kay Diederichs                http://strucbio.biologie.uni-konstanz.de
>> email: Kay.Diederichs@uni-konstanz.de             Tel +49 7531 88 4049
>> Fachbereich Biologie, Universität Konstanz, Box M647, D-78457 Konstanz
>>
>> This e-mail is digitally signed. If your e-mail client does not have the
>> necessary capabilities, just ignore the attached signature "smime.p7s".
>>
>

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

* Re: is there a way to find out gfortran version and/or options from a given binary?
  2022-06-01 11:46               ` Arjen Markus
@ 2022-06-01 12:04                 ` Kay Diederichs
  2022-06-01 12:19                   ` Arjen Markus
  0 siblings, 1 reply; 19+ messages in thread
From: Kay Diederichs @ 2022-06-01 12:04 UTC (permalink / raw)
  To: Arjen Markus; +Cc: Andre Vehreschild, Fortran List

[-- Attachment #1: Type: text/plain, Size: 5146 bytes --]

Hi Arjen,

below is what I get with gfortran 11.2.1 and no options, or just -g:

[dikay@turn29]$ gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/scratch/opt/rh/devtoolset-11/root/usr/bin/../libexec/gcc/x86_64-redhat-linux/11/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/opt/rh/devtoolset-11/root/usr --mandir=/opt/rh/devtoolset-11/root/usr/share/man --infodir=/opt/rh/devtoolset-11/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --with-default-libstdcxx-abi=gcc4-compatible --enable-plugin --enable-initfini-array --with-isl=/builddir/build/BUILD/gcc-11.2.1-20210728/obj-x86_64-redhat-linux/isl-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.2.1 20210728 (Red Hat 11.2.1-1) (GCC)
[dikay@turn29]$ cat staticv.f90
! staticv.f90 --
!     Static information about the compiler? Not via parameters
!
program staticv
     use iso_fortran_env

     implicit none
     character(len=200) :: c, d

     c = compiler_version()
     d = compiler_options()
     write(*,*) c(1:1), d(1:1)
end program staticv


[dikay@turn29]$ gfortran staticv.f90
[dikay@turn29]$ strings a.out | grep GNU
GCC: (GNU) 4.8.5 20150623 (Red Hat 4.8.5-44)
GCC: (GNU) 11.2.1 20210728 (Red Hat 11.2.1-1)
__GNU_EH_FRAME_HDR

[dikay@turn29]$ gfortran staticv.f90
[dikay@turn29]$ strings a.out | grep GNU
GCC: (GNU) 4.8.5 20150623 (Red Hat 4.8.5-44)
GCC: (GNU) 11.2.1 20210728 (Red Hat 11.2.1-1)
__GNU_EH_FRAME_HDR
[dikay@turn29]$ gfortran -g staticv.f90
[dikay@turn29]$ strings a.out | grep GNU
GCC: (GNU) 4.8.5 20150623 (Red Hat 4.8.5-44)
GCC: (GNU) 11.2.1 20210728 (Red Hat 11.2.1-1)
GNU Fortran2008 11.2.1 20210728 (Red Hat 11.2.1-1) -mtune=generic -march=x86-64 -g -fintrinsic-modules-path /scratch/opt/rh/devtoolset-11/root/usr/bin/../lib/gcc/x86_64-redhat-linux/11/finclude
__GNU_EH_FRAME_HDR

Best wishes,
Kay



On 6/1/22 13:46, Arjen Markus wrote:
> Are you sure that -g is the trigger? It may very well be that you need to make sure that the optimiser does not eliminate the variable that holds the identification. That is why I write the first character of these strings, to make sure that the variables are retained. That could be achieved in all manner of ways to fool the optimiser. Note that with -O2 and the program I posted I still get the strings.
> 
> Regards,
> 
> Arjen
> 
> Op wo 1 jun. 2022 om 13:36 schreef Arjen Markus <arjen.markus895@gmail.com <mailto:arjen.markus895@gmail.com>>:
> 
>     Hm, I ran it without any options - would that be equivalent to -g then? A rather awkward workaround might be to compile one source file containing this code with -g, but that is pushing things to the limit.
> 
>     Regards,
> 
>     Arjen
> 
>     Op wo 1 jun. 2022 om 12:16 schreef Kay Diederichs <kay.diederichs@uni-konstanz.de <mailto:kay.diederichs@uni-konstanz.de>>:
> 
>         I tried your suggestion below, but it does not store the options unless
>         the -g option is used.
> 
>         If -g is used, the executable _always_ has version and option info (no
>         extra code invoking compiler_version() and compiler_options() is
>         needed). Just use strings <binary> | grep GNU .
>         If -g is not used, no option info is in the executable.
> 
>         Best wishes,
>         Kay
> 
>         On 01.06.22 12:00, Arjen Markus wrote:
>          > staticv.f90 --
>          > !     Static information about the compiler? Not via parameters
>          > !
>          > program staticv
>          >      use iso_fortran_env
>          >
>          >      implicit none
>          >      character(len=200) :: c, d
>          >
>          >      c = compiler_version()
>          >      d = compiler_options()
>          >      write(*,*) c(1:1), d(1:)1
>          > end program staticv
>          >
> 
>         -- 
>         Kay Diederichs http://strucbio.biologie.uni-konstanz.de <http://strucbio.biologie.uni-konstanz.de>
>         email: Kay.Diederichs@uni-konstanz.de <mailto:Kay.Diederichs@uni-konstanz.de>             Tel +49 7531 88 4049
>         Fachbereich Biologie, Universität Konstanz, Box M647, D-78457 Konstanz
> 
>         This e-mail is digitally signed. If your e-mail client does not have the
>         necessary capabilities, just ignore the attached signature "smime.p7s".
> 

-- 
Kay Diederichs                http://strucbio.biologie.uni-konstanz.de
email: Kay.Diederichs@uni-konstanz.de             Tel +49 7531 88 4049
Fachbereich Biologie, Universität Konstanz, Box M647, D-78457 Konstanz

This e-mail is digitally signed. If your e-mail client does not have the
necessary capabilities, just ignore the attached signature "smime.p7s".

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 5905 bytes --]

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

* Re: is there a way to find out gfortran version and/or options from a given binary?
  2022-06-01 12:04                 ` Kay Diederichs
@ 2022-06-01 12:19                   ` Arjen Markus
  0 siblings, 0 replies; 19+ messages in thread
From: Arjen Markus @ 2022-06-01 12:19 UTC (permalink / raw)
  To: Kay Diederichs; +Cc: Andre Vehreschild, Fortran List

Hm, I was using a file viewer, not strings to examine the file and I looked
for the text "GCC". That must be the difference. Indeed, strings does not
show that string nor any string containing "GCC"

Here is a small part of the text in the file (compiled without -O2, as with
it some characters appear mangled):

      GCC version 10.2.0-mtune=generic -march=x86-64staticv.f90       D  ÿ
                    Trace/breakpoint trap SIGTRAP Terminal quit signal

Regards,

Arjen

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

* Re: is there a way to find out gfortran version and/or options from a given binary?
  2022-06-01 10:16           ` Kay Diederichs
  2022-06-01 11:36             ` Arjen Markus
@ 2022-06-02 19:06             ` Janne Blomqvist
  2022-06-02 19:33               ` Kay Diederichs
  1 sibling, 1 reply; 19+ messages in thread
From: Janne Blomqvist @ 2022-06-02 19:06 UTC (permalink / raw)
  To: Kay Diederichs; +Cc: Arjen Markus, Andre Vehreschild, Fortran List

On Wed, Jun 1, 2022 at 1:16 PM Kay Diederichs
<kay.diederichs@uni-konstanz.de> wrote:
> If -g is used, the executable _always_ has version and option info

Well, isn't that the answer to your question then?

As an alternative approach, make a command-line option (say, "-v")
that prints the version number of the program, name of the author and
other pertinent information, as well as the output of
compiler_version() and compiler_options(), and then exits. That would
ensure that those calls won't be optimized away.

-- 
Janne Blomqvist

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

* Re: is there a way to find out gfortran version and/or options from a given binary?
  2022-06-02 19:06             ` Janne Blomqvist
@ 2022-06-02 19:33               ` Kay Diederichs
  2022-06-03  5:22                 ` Janne Blomqvist
  0 siblings, 1 reply; 19+ messages in thread
From: Kay Diederichs @ 2022-06-02 19:33 UTC (permalink / raw)
  To: Janne Blomqvist; +Cc: Arjen Markus, Andre Vehreschild, Fortran List

[-- Attachment #1: Type: text/plain, Size: 1995 bytes --]



Am 02.06.22 um 21:06 schrieb Janne Blomqvist:
> On Wed, Jun 1, 2022 at 1:16 PM Kay Diederichs
> <kay.diederichs@uni-konstanz.de> wrote:
>> If -g is used, the executable _always_ has version and option info
> 
> Well, isn't that the answer to your question then?
> 
> As an alternative approach, make a command-line option (say, "-v")
> that prints the version number of the program, name of the author and
> other pertinent information, as well as the output of
> compiler_version() and compiler_options(), and then exits. That would
> ensure that those calls won't be optimized away.
> 

I was thinking of such a -v option as well, and it is a solution for 
some situations, but not e.g. for a dynamically loadable library (see 
https://cims.nyu.edu/~donev/Fortran/DLL/DLL.Forum.txt ) which is my 
situation ( 
https://strucbio.biologie.uni-konstanz.de/xdswiki/index.php/LIB ). I'd 
like to be able to see later which compiler version and options were 
used when compiling that library, because over the years of distributing 
this code, compilers and options have been changing.

-g includes the source code, which is not always desired, and is not 
possible here due to license issues - there was no concept of "open 
source" as we have it today in the 80ies when this code was started. 
Also I think it makes the code slower.

Using
strings <binary> | grep GCC
I get meaningful output when e.g. -O2 is used as compiler option, but 
not for other options. I don't understand it yet which is why I wish 
there were a dedicated compiler option for including the compilation 
line in the binary (like -sox for ifort).

Best, Kay
-- 
Kay Diederichs                http://strucbio.biologie.uni-konstanz.de
email: Kay.Diederichs@uni-konstanz.de             Tel +49 7531 88 4049
Fachbereich Biologie, Universität Konstanz, Box M647, D-78457 Konstanz

This e-mail is digitally signed. If your e-mail client does not have the
necessary capabilities, just ignore the attached signature "smime.p7s".

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 5905 bytes --]

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

* Re: is there a way to find out gfortran version and/or options from a given binary?
  2022-06-02 19:33               ` Kay Diederichs
@ 2022-06-03  5:22                 ` Janne Blomqvist
  2022-06-03  6:47                   ` Arjen Markus
  0 siblings, 1 reply; 19+ messages in thread
From: Janne Blomqvist @ 2022-06-03  5:22 UTC (permalink / raw)
  To: Kay Diederichs; +Cc: Arjen Markus, Andre Vehreschild, Fortran List

On Thu, Jun 2, 2022 at 10:33 PM Kay Diederichs
<kay.diederichs@uni-konstanz.de> wrote:
> Am 02.06.22 um 21:06 schrieb Janne Blomqvist:
> > As an alternative approach, make a command-line option (say, "-v")
> > that prints the version number of the program, name of the author and
> > other pertinent information, as well as the output of
> > compiler_version() and compiler_options(), and then exits. That would
> > ensure that those calls won't be optimized away.
> >
>
> I was thinking of such a -v option as well, and it is a solution for
> some situations, but not e.g. for a dynamically loadable library (see
> https://cims.nyu.edu/~donev/Fortran/DLL/DLL.Forum.txt ) which is my
> situation (
> https://strucbio.biologie.uni-konstanz.de/xdswiki/index.php/LIB ). I'd
> like to be able to see later which compiler version and options were
> used when compiling that library, because over the years of distributing
> this code, compilers and options have been changing.

For the library case, can't you make a function
libraryname_print_version_info() or whatever you want to call it that
does the same? Of course, if the user never calls that function, uses
a static library, and everything is compiled with -ffunction-sections
and linked with --gc-sections that will not work, but otherwise the
string should still be there in the binary so you should be able to
find it with the strings tool?

> -g includes the source code, which is not always desired, and is not
> possible here due to license issues - there was no concept of "open
> source" as we have it today in the 80ies when this code was started.

Hmm, maybe that's the case, I don't have a legal opinion to offer on
this, sorry.

> Also I think it makes the code slower.

No, at least with GCC -g doesn't affect the code generation. It makes
the binary bigger so it takes longer to copy around, and depending on
how the debug info is spread out in the binary some of that might be
unnecessarily mapped into memory when running, but I think you'd be
very hard pressed to measure any difference in performance.

-- 
Janne Blomqvist

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

* Re: is there a way to find out gfortran version and/or options from a given binary?
  2022-06-03  5:22                 ` Janne Blomqvist
@ 2022-06-03  6:47                   ` Arjen Markus
       [not found]                     ` <14d31069-82ab-5a7a-2f35-15411da30141@uni-konstanz.de>
  0 siblings, 1 reply; 19+ messages in thread
From: Arjen Markus @ 2022-06-03  6:47 UTC (permalink / raw)
  To: Janne Blomqvist; +Cc: Kay Diederichs, Andre Vehreschild, Fortran List

Do you know why the strings command does not show the identification
string,
which clearly present in the executable file, even though it should examine
the
entire file (the --all option does not alter the output)?

Regards,

Arjen

Op vr 3 jun. 2022 om 07:22 schreef Janne Blomqvist <
blomqvist.janne@gmail.com>:

> On Thu, Jun 2, 2022 at 10:33 PM Kay Diederichs
> <kay.diederichs@uni-konstanz.de> wrote:
> > Am 02.06.22 um 21:06 schrieb Janne Blomqvist:
> > > As an alternative approach, make a command-line option (say, "-v")
> > > that prints the version number of the program, name of the author and
> > > other pertinent information, as well as the output of
> > > compiler_version() and compiler_options(), and then exits. That would
> > > ensure that those calls won't be optimized away.
> > >
> >
> > I was thinking of such a -v option as well, and it is a solution for
> > some situations, but not e.g. for a dynamically loadable library (see
> > https://cims.nyu.edu/~donev/Fortran/DLL/DLL.Forum.txt ) which is my
> > situation (
> > https://strucbio.biologie.uni-konstanz.de/xdswiki/index.php/LIB ). I'd
> > like to be able to see later which compiler version and options were
> > used when compiling that library, because over the years of distributing
> > this code, compilers and options have been changing.
>
> For the library case, can't you make a function
> libraryname_print_version_info() or whatever you want to call it that
> does the same? Of course, if the user never calls that function, uses
> a static library, and everything is compiled with -ffunction-sections
> and linked with --gc-sections that will not work, but otherwise the
> string should still be there in the binary so you should be able to
> find it with the strings tool?
>
> > -g includes the source code, which is not always desired, and is not
> > possible here due to license issues - there was no concept of "open
> > source" as we have it today in the 80ies when this code was started.
>
> Hmm, maybe that's the case, I don't have a legal opinion to offer on
> this, sorry.
>
> > Also I think it makes the code slower.
>
> No, at least with GCC -g doesn't affect the code generation. It makes
> the binary bigger so it takes longer to copy around, and depending on
> how the debug info is spread out in the binary some of that might be
> unnecessarily mapped into memory when running, but I think you'd be
> very hard pressed to measure any difference in performance.
>
> --
> Janne Blomqvist
>

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

* Re: is there a way to find out gfortran version and/or options from a given binary?
       [not found]                     ` <14d31069-82ab-5a7a-2f35-15411da30141@uni-konstanz.de>
@ 2022-06-03  7:30                       ` Arjen Markus
  2022-06-03  8:16                         ` Janne Blomqvist
  0 siblings, 1 reply; 19+ messages in thread
From: Arjen Markus @ 2022-06-03  7:30 UTC (permalink / raw)
  To: Kay Diederichs, Fortran List

Hi Kay,

(you forgot to reply to everybody ;))

I am using a Windows version of gfortran and strings. I use a file viewer
that comes with the Total Commander file manager. So, it may be something
specific to that version of strings.

Regards,

Arjen

Op vr 3 jun. 2022 om 09:25 schreef Kay Diederichs <
kay.diederichs@uni-konstanz.de>:

> On 6/3/22 08:47, Arjen Markus via Fortran wrote:
> > Do you know why the strings command does not show the identification
> > string,
> > which clearly present in the executable file, even though it should
> examine
> > the
> > entire file (the --all option does not alter the output)?
> >
> > Regards,
> >
> > Arjen
> >
> > Op vr 3 jun. 2022 om 07:22 schreef Janne Blomqvist <
> > blomqvist.janne@gmail.com>:
> >
> >> On Thu, Jun 2, 2022 at 10:33 PM Kay Diederichs
> >> <kay.diederichs@uni-konstanz.de> wrote:
> >>> Am 02.06.22 um 21:06 schrieb Janne Blomqvist:
> >>>> As an alternative approach, make a command-line option (say, "-v")
> >>>> that prints the version number of the program, name of the author and
> >>>> other pertinent information, as well as the output of
> >>>> compiler_version() and compiler_options(), and then exits. That would
> >>>> ensure that those calls won't be optimized away.
> >>>>
> >>>
> >>> I was thinking of such a -v option as well, and it is a solution for
> >>> some situations, but not e.g. for a dynamically loadable library (see
> >>> https://cims.nyu.edu/~donev/Fortran/DLL/DLL.Forum.txt ) which is my
> >>> situation (
> >>> https://strucbio.biologie.uni-konstanz.de/xdswiki/index.php/LIB ). I'd
> >>> like to be able to see later which compiler version and options were
> >>> used when compiling that library, because over the years of
> distributing
> >>> this code, compilers and options have been changing.
> >>
> >> For the library case, can't you make a function
> >> libraryname_print_version_info() or whatever you want to call it that
> >> does the same? Of course, if the user never calls that function, uses
> >> a static library, and everything is compiled with -ffunction-sections
> >> and linked with --gc-sections that will not work, but otherwise the
> >> string should still be there in the binary so you should be able to
> >> find it with the strings tool?
> >>
> >>> -g includes the source code, which is not always desired, and is not
> >>> possible here due to license issues - there was no concept of "open
> >>> source" as we have it today in the 80ies when this code was started.
> >>
> >> Hmm, maybe that's the case, I don't have a legal opinion to offer on
> >> this, sorry.
> >>
> >>> Also I think it makes the code slower.
> >>
> >> No, at least with GCC -g doesn't affect the code generation. It makes
> >> the binary bigger so it takes longer to copy around, and depending on
> >> how the debug info is spread out in the binary some of that might be
> >> unnecessarily mapped into memory when running, but I think you'd be
> >> very hard pressed to measure any difference in performance.
> >>
> >> --
> >> Janne Blomqvist
> >>
> >
>
> Arjen,
>
> "egrep"-ing for 'GNU|GCC' in the "strings" output shows more than
> "grep"-ing for GNU, which is what I tried first.
> But I don't think you see even more with a "fileviewer" (which do you
> refer to?
> I tried the "bless" hex editor and "okteta"; they don't show more than
> "strings").
>
> @Janne thanks for pointing out that -g does not make the code slower.
> Is there an option that prevents the sourcecode to be included when -g is
> used?
>
> thanks,
> Kay
>

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

* Re: is there a way to find out gfortran version and/or options from a given binary?
  2022-06-03  7:30                       ` Arjen Markus
@ 2022-06-03  8:16                         ` Janne Blomqvist
  2022-06-03 10:12                           ` Kay Diederichs
  0 siblings, 1 reply; 19+ messages in thread
From: Janne Blomqvist @ 2022-06-03  8:16 UTC (permalink / raw)
  To: Arjen Markus; +Cc: Kay Diederichs, Fortran List

On Fri, Jun 3, 2022 at 10:30 AM Arjen Markus via Fortran
<fortran@gcc.gnu.org> wrote:
>
> Hi Kay,
>
> (you forgot to reply to everybody ;))
>
> I am using a Windows version of gfortran and strings. I use a file viewer
> that comes with the Total Commander file manager. So, it may be something
> specific to that version of strings.

One caveat being that Fortran strings are not NULL terminated like C
strings. So a tool that searches for C-style strings in a binary might
not find Fortran-style strings unless there happens to be a NULL after
them for some other reason. The version of strings included in GNU
binutils searches for strings terminated by any non-printable
character, so it finds Fortran style strings (and a lot of noise which
isn't strings).

> Op vr 3 jun. 2022 om 09:25 schreef Kay Diederichs <
> kay.diederichs@uni-konstanz.de>:
> > @Janne thanks for pointing out that -g does not make the code slower.
> > Is there an option that prevents the sourcecode to be included when -g is
> > used?

You might try -frecord-gcc-switches. There's also
-grecord-gcc-switches (which puts the info somewhere in the debug
data), which is enabled by -g, but without -g it seems it doesn't do
anything.

-- 
Janne Blomqvist

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

* Re: is there a way to find out gfortran version and/or options from a given binary?
  2022-06-03  8:16                         ` Janne Blomqvist
@ 2022-06-03 10:12                           ` Kay Diederichs
  2022-06-03 10:12                             ` Kay Diederichs
  0 siblings, 1 reply; 19+ messages in thread
From: Kay Diederichs @ 2022-06-03 10:12 UTC (permalink / raw)
  To: Janne Blomqvist, Arjen Markus; +Cc: Fortran List

On 6/3/22 10:16, Janne Blomqvist via Fortran wrote:
> On Fri, Jun 3, 2022 at 10:30 AM Arjen Markus via Fortran
> <fortran@gcc.gnu.org> wrote:
>>
>> Hi Kay,
>>
>> (you forgot to reply to everybody ;))
>>
>> I am using a Windows version of gfortran and strings. I use a file viewer
>> that comes with the Total Commander file manager. So, it may be something
>> specific to that version of strings.
> 
> One caveat being that Fortran strings are not NULL terminated like C
> strings. So a tool that searches for C-style strings in a binary might
> not find Fortran-style strings unless there happens to be a NULL after
> them for some other reason. The version of strings included in GNU
> binutils searches for strings terminated by any non-printable
> character, so it finds Fortran style strings (and a lot of noise which
> isn't strings).
> 
>> Op vr 3 jun. 2022 om 09:25 schreef Kay Diederichs <
>> kay.diederichs@uni-konstanz.de>:
>>> @Janne thanks for pointing out that -g does not make the code slower.
>>> Is there an option that prevents the sourcecode to be included when -g is
>>> used?
> 
> You might try -frecord-gcc-switches. There's also
> -grecord-gcc-switches (which puts the info somewhere in the debug
> data), which is enabled by -g, but without -g it seems it doesn't do
> anything.
> 

thanks for pointing at -frecord-gcc-switches . This appears to be what I was looking for.
Googling for frecord-gcc-switches (without the leading "-", of course) brings up very interesting exchanges.
For the record, when -frecord-gcc-switches  is used in compilation,
objdump -s --section=.GCC.command.line <binary>
or
readelf -p .GCC.command.line <binary>
shows the compiler options.
I have not (yet) tried to find out how -grecord-gcc-switches differs, nor if and why the suggestion to
"Introduce a new GCC option, --record-gcc-command-line" was rejected
( https://gcc.gnu.org/legacy-ml/gcc-patches/2019-11/msg00434.html ).

Thanks to all who responded!
Kay

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

* Re: is there a way to find out gfortran version and/or options from a given binary?
  2022-06-03 10:12                           ` Kay Diederichs
@ 2022-06-03 10:12                             ` Kay Diederichs
  0 siblings, 0 replies; 19+ messages in thread
From: Kay Diederichs @ 2022-06-03 10:12 UTC (permalink / raw)
  To: fortran; +Cc: Fortran List

On 6/3/22 10:16, Janne Blomqvist via Fortran wrote:
> On Fri, Jun 3, 2022 at 10:30 AM Arjen Markus via Fortran
> <fortran@gcc.gnu.org> wrote:
>>
>> Hi Kay,
>>
>> (you forgot to reply to everybody ;))
>>
>> I am using a Windows version of gfortran and strings. I use a file viewer
>> that comes with the Total Commander file manager. So, it may be something
>> specific to that version of strings.
> 
> One caveat being that Fortran strings are not NULL terminated like C
> strings. So a tool that searches for C-style strings in a binary might
> not find Fortran-style strings unless there happens to be a NULL after
> them for some other reason. The version of strings included in GNU
> binutils searches for strings terminated by any non-printable
> character, so it finds Fortran style strings (and a lot of noise which
> isn't strings).
> 
>> Op vr 3 jun. 2022 om 09:25 schreef Kay Diederichs <
>> kay.diederichs@uni-konstanz.de>:
>>> @Janne thanks for pointing out that -g does not make the code slower.
>>> Is there an option that prevents the sourcecode to be included when -g is
>>> used?
> 
> You might try -frecord-gcc-switches. There's also
> -grecord-gcc-switches (which puts the info somewhere in the debug
> data), which is enabled by -g, but without -g it seems it doesn't do
> anything.
> 

thanks for pointing at -frecord-gcc-switches . This appears to be what I was looking for.
Googling for frecord-gcc-switches (without the leading "-", of course) brings up very interesting exchanges.
For the record, when -frecord-gcc-switches  is used in compilation,
objdump -s --section=.GCC.command.line <binary>
or
readelf -p .GCC.command.line <binary>
shows the compiler options.
I have not (yet) tried to find out how -grecord-gcc-switches differs, nor if and why the suggestion to
"Introduce a new GCC option, --record-gcc-command-line" was rejected
( https://gcc.gnu.org/legacy-ml/gcc-patches/2019-11/msg00434.html ).

Thanks to all who responded!
Kay


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

end of thread, other threads:[~2022-06-03 10:12 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-01  8:42 is there a way to find out gfortran version and/or options from a given binary? Kay Diederichs
2022-06-01  9:30 ` Arjen Markus
2022-06-01  9:41   ` Kay Diederichs
2022-06-01  9:50     ` Andre Vehreschild
2022-06-01  9:53       ` Arjen Markus
2022-06-01 10:00         ` Arjen Markus
2022-06-01 10:16           ` Kay Diederichs
2022-06-01 11:36             ` Arjen Markus
2022-06-01 11:46               ` Arjen Markus
2022-06-01 12:04                 ` Kay Diederichs
2022-06-01 12:19                   ` Arjen Markus
2022-06-02 19:06             ` Janne Blomqvist
2022-06-02 19:33               ` Kay Diederichs
2022-06-03  5:22                 ` Janne Blomqvist
2022-06-03  6:47                   ` Arjen Markus
     [not found]                     ` <14d31069-82ab-5a7a-2f35-15411da30141@uni-konstanz.de>
2022-06-03  7:30                       ` Arjen Markus
2022-06-03  8:16                         ` Janne Blomqvist
2022-06-03 10:12                           ` Kay Diederichs
2022-06-03 10:12                             ` Kay Diederichs

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