From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ciao.gmane.io (ciao.gmane.io [116.202.254.214]) by sourceware.org (Postfix) with ESMTPS id 293D53AAA005 for ; Fri, 3 Jun 2022 10:12:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 293D53AAA005 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=uni-konstanz.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=m.gmane-mx.org Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1nx4IG-0003Gq-6E for fortran@gcc.gnu.org; Fri, 03 Jun 2022 12:12:36 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: fortran@gcc.gnu.org From: Kay Diederichs 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 Message-ID: <5332f472-6188-aa8b-1d91-7c84ec265f0a@uni-konstanz.de> References: <20220601115026.452a6840@vepi2> <14d31069-82ab-5a7a-2f35-15411da30141@uni-konstanz.de> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Cc: Fortran List Content-Language: en-US In-Reply-To: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_SHORT, NICE_REPLY_A, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: fortran@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Fortran mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jun 2022 10:12:39 -0000 Message-ID: <20220603101229.F0pjhHp3ACg52BET6kL1GLZz4KNPyV1EKeZTqFwFL5Q@z> On 6/3/22 10:16, Janne Blomqvist via Fortran wrote: > On Fri, Jun 3, 2022 at 10:30 AM Arjen Markus via Fortran > 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 or readelf -p .GCC.command.line 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