From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oa1-x29.google.com (mail-oa1-x29.google.com [IPv6:2001:4860:4864:20::29]) by sourceware.org (Postfix) with ESMTPS id DE24E3853541 for ; Fri, 3 Jun 2022 05:22:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DE24E3853541 Received: by mail-oa1-x29.google.com with SMTP id 586e51a60fabf-f314077115so9448368fac.1 for ; Thu, 02 Jun 2022 22:22:42 -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:cc; bh=LOSEeNXAp6aJGRy/1wWwNz8kJ8Qx5JD36CPgtdv9V1I=; b=cpy/YOScGoUgnajoFA+05IYahix1rtXxeed2EBUwnBrMIm0O+UMFPtpc8X3bnhM9q6 p+QF5Zp3XWpJAOtUYe7Jei37YKVQQoRRckTWcFHPN7OIpLHE7f7jxln5cx86DjKWAac3 /UxDqXjQtJcYcjspHsV68Tvr68TFrHBRtV5fzE58keJXq6Bvns775iw/jEQlKMMCyXEQ 2byUfv929RlFBmsRdW8ITfiS/1sqSKi1OuBfLIVrczKLy7bJ/51fV7qqa9s0c2v8W/hG kAjrCqHAp/NSdoKqlNJaTh4dHK3cFyxDYjtXbN3g21i3rsxMDCdxtkXNBOcyPMG/bw8D 49zw== X-Gm-Message-State: AOAM532lLlAP8rpH3U4wNe5g4WKEXUAHLyuKRKR72bR3OTUSxZIB3vIt U3ILk/5V/TEXWUPtfhWF09/MrR+6GAbA/OAOt5A= X-Google-Smtp-Source: ABdhPJyoGDJyIrHjsgFc+DhS7WugVq/2pBx91kndkuWJD6ItZXYGEKTlb72k3dYcB9sqISxlGMWK0cZj6Ud3sOCIubg= X-Received: by 2002:a05:6870:430d:b0:f2:d28b:3444 with SMTP id w13-20020a056870430d00b000f2d28b3444mr22087493oah.211.1654233762114; Thu, 02 Jun 2022 22:22:42 -0700 (PDT) MIME-Version: 1.0 References: <20220601115026.452a6840@vepi2> In-Reply-To: From: Janne Blomqvist Date: Fri, 3 Jun 2022 08:22:30 +0300 Message-ID: Subject: Re: is there a way to find out gfortran version and/or options from a given binary? To: Kay Diederichs Cc: Arjen Markus , Andre Vehreschild , Fortran List Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=1.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, 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 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 05:22:44 -0000 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