From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from thurn.uni-konstanz.de (mailout.uni-konstanz.de [134.34.240.38]) by sourceware.org (Postfix) with ESMTPS id DD7B13AA9C1E for ; Fri, 3 Jun 2022 10:12:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DD7B13AA9C1E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=uni-konstanz.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=uni-konstanz.de Received: from omicron.kim.uni-konstanz.de (omicron.kim.uni-konstanz.de [134.34.240.43]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by thurn.uni-konstanz.de (Postfix) with ESMTPS id 4LDzG83Xdkz1cR; Fri, 3 Jun 2022 12:12:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uni-konstanz.de; s=DKIM001; t=1654251152; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=r6k442Sl1DsSckb56Lj8AjRdp2XC9xubDoRrVmlX6N4=; b=bmGGCArTvXYi3SKUf4xXL1b+A6k2UvFvBTIqCCO80I8staXg0O84sCLmKSSAQBncM+EtaU 6yJTwpdkGvZd9Dg1lNw0UyFlMq9Bsre2V0QwlKLovjTBo26uYyzedXYBXxC7hVOO5+1rvy +Ak8mfD9vLqC0tozRjdeghdPektfTaA3gL8MIpErSI+MjuZ6E+ln83cebnJJNIcFDw84VN S3nHi5947loM3Dj4uteC0+nnCSeI0L7oRK57/Lu3PoyrEsGwihqhyBzTUK3PwRDTvdL05O dJZYqZaFwpqLLgJknIVZJ8+mE3NoGZebYWjrHlYwy2k5XrdB+eNKCy19tXNGlA== Received: from omicron.kim.uni-konstanz.de (localhost [134.34.116.39]) by omicron.kim.uni-konstanz.de (Postfix) with ESMTPSA id 469B388B; Fri, 3 Jun 2022 12:12:30 +0200 (CEST) Received: from dovecot-director-1.kim.uni-konstanz.de ([134.34.116.39]) by omicron.kim.uni-konstanz.de with ESMTPSA id AeXAEI7emWKiGwAA6IBqqw (envelope-from ); Fri, 03 Jun 2022 12:12:30 +0200 Message-ID: <5332f472-6188-aa8b-1d91-7c84ec265f0a@uni-konstanz.de> Date: Fri, 3 Jun 2022 12:12:29 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: is there a way to find out gfortran version and/or options from a given binary? Content-Language: en-US To: Janne Blomqvist , Arjen Markus Cc: Fortran List Newsgroups: gmane.comp.gcc.fortran References: <20220601115026.452a6840@vepi2> <14d31069-82ab-5a7a-2f35-15411da30141@uni-konstanz.de> From: Kay Diederichs In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-KN-RS-ID: c8ab3f1592f5a5e6a73 X-KN-RS-META: 6m5ii8xknb9gwb6b5u8z3gtunhga3gee X-Rspamd-Server: nosferatu.kim.uni-konstanz.de X-Rspamd-Queue-Id: 4LDzG83Xdkz1cR Authentication-Results: Mailout; dkim=none X-Rspamd-SPAM-Probability: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, JMQ_SPF_NEUTRAL, 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-Stat-Signature: e5dqostx5eyde9d8zoxdzqctao56q6ki 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:35 -0000 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 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