From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by sourceware.org (Postfix) with ESMTPS id 740B2383A317 for ; Fri, 3 Jun 2022 07:30:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 740B2383A317 Received: by mail-pl1-x62c.google.com with SMTP id n8so6315003plh.1 for ; Fri, 03 Jun 2022 00:30:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=2LRmh+tHGqm3VWaxbCsl4I1RykaPAJWgruW75AO3ty4=; b=uwluhapPWfKoK0RIC1OlDtqW+pLbL4ZIs/TCkBytQFJNtuJ8cBc3pV3YPPNajRoORG 9+Ht6CwY7nhYZSOuHCXvsckMoXh5cxzCw/3V2lh39zxLAxgj1yL9AkREUDcAVkBZQ8o0 GfH6gj9z3eN0r0UJcwc4bSMqAIGjNp01EJ4I1tBOslpKQTIjFX8aGxsnAds8fftW5xZj SHSl7yjb0zG4RSqJwd3tFp+bekkFPTt0xIJmuhx7rgyKvqfCj6st378tiX9DwOwCeLe2 XBpS4EnVv6LZIXKA0Fv+1reZrdmvCuJ0GaRQuD4GphAv4AAyVrX0NyhlV2fpMNh8ci6v I4Ow== X-Gm-Message-State: AOAM533U4V1AJLfrWikDbr+yxxGQTeV6u+OWnH8/1GCAC//EuBmfgr1j vN0difyRYzfU+LtRP91rXkjp/Xx7aWVs9x4diqE= X-Google-Smtp-Source: ABdhPJzfX7mxwFn76nEixNJQRrAGhYEYA0d1QMP2eCFm/Ei3ttRgKOgIS7DXEmH3NFvtxL9ZRsEWMurU+YEf+I8tpDE= X-Received: by 2002:a17:90a:448e:b0:1e0:901b:1b3f with SMTP id t14-20020a17090a448e00b001e0901b1b3fmr9763410pjg.95.1654241439107; Fri, 03 Jun 2022 00:30:39 -0700 (PDT) MIME-Version: 1.0 References: <20220601115026.452a6840@vepi2> <14d31069-82ab-5a7a-2f35-15411da30141@uni-konstanz.de> In-Reply-To: <14d31069-82ab-5a7a-2f35-15411da30141@uni-konstanz.de> From: Arjen Markus Date: Fri, 3 Jun 2022 09:30:27 +0200 Message-ID: Subject: Re: is there a way to find out gfortran version and/or options from a given binary? To: Kay Diederichs , Fortran List X-Spam-Status: No, score=1.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, HTML_MESSAGE, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, URI_DOTEDU autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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 07:30:42 -0000 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 > >> 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 >