public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Arjen Markus <arjen.markus895@gmail.com>
To: Andre Vehreschild <vehre@gmx.de>
Cc: Kay Diederichs <Kay.Diederichs@uni-konstanz.de>,
	Fortran List <fortran@gcc.gnu.org>
Subject: Re: is there a way to find out gfortran version and/or options from a given binary?
Date: Wed, 1 Jun 2022 12:00:52 +0200	[thread overview]
Message-ID: <CAMCbSMq1E2zWPrrcg7HUN_QL_AJ=0surwxsNL5G35jJbBQM8Hg@mail.gmail.com> (raw)
In-Reply-To: <CAMCbSMobAfAiqpMZtO_FQhn7uHGdRPchL_dDqh-uASaHwB9UHw@mail.gmail.com>

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

  reply	other threads:[~2022-06-01 10:01 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-01  8:42 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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMCbSMq1E2zWPrrcg7HUN_QL_AJ=0surwxsNL5G35jJbBQM8Hg@mail.gmail.com' \
    --to=arjen.markus895@gmail.com \
    --cc=Kay.Diederichs@uni-konstanz.de \
    --cc=fortran@gcc.gnu.org \
    --cc=vehre@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).