public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Kay Diederichs <kay.diederichs@uni-konstanz.de>
To: fortran@gcc.gnu.org
Cc: 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: Fri, 3 Jun 2022 12:12:29 +0200	[thread overview]
Message-ID: <5332f472-6188-aa8b-1d91-7c84ec265f0a@uni-konstanz.de> (raw)
Message-ID: <20220603101229.F0pjhHp3ACg52BET6kL1GLZz4KNPyV1EKeZTqFwFL5Q@z> (raw)
In-Reply-To: <CAO9iq9HtQrWgs_7O_3Fhxu4=sJkgxM=skeZDuLVhUPZyc=nW9w@mail.gmail.com>

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


  reply	other threads:[~2022-06-03 10:12 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
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 [this message]
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=5332f472-6188-aa8b-1d91-7c84ec265f0a@uni-konstanz.de \
    --to=kay.diederichs@uni-konstanz.de \
    --cc=fortran@gcc.gnu.org \
    /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).