From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vs1-xe2b.google.com (mail-vs1-xe2b.google.com [IPv6:2607:f8b0:4864:20::e2b]) by sourceware.org (Postfix) with ESMTPS id 337C53858405 for ; Wed, 1 Jun 2022 10:01:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 337C53858405 Received: by mail-vs1-xe2b.google.com with SMTP id 68so1144639vse.11 for ; Wed, 01 Jun 2022 03:01:15 -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=PB5ZRWer9WlQypr3rbThUFSwgqtKt4Lv2maVWX61Mb0=; b=blWHGek84l3xdcm+O9B3zlGiccPAdm2+4y8VX94Yze1L3rH/zzWSEPZ/41KLQG4X98 bYX7Ps7u/fkrN/BxIAEBnEEP8XzXTpobt4W9GnUAj0vb6er1iCMmt/liaEAqsmChc0hG Z+gf0rXvluWzXKHflXC5Uk2ekPUwAJ7VpeywyssN3SLmVQNYwmvvEAeA0rDYP/o8X1+B lJjlK5QGM/icd9EyiNE+uimhmrnopdKUM5mwUzQDRBR6fBFtHg579Oh13k1BvOhyqV1H eCVgFZBgq3hPZFaquzj7FEmoM670eSuapWPAfZJJrz4qw7itfYMAvvdAMpFCfWkJ4skw MF7Q== X-Gm-Message-State: AOAM533zfGEW/l6rz3jlVjwjS9hAevhiBSM2YZbFdAmhW4TxkxOJNK1F vzmj7SRqMraGGK4eZLbR47jg+r8+p2fZO528zI+pXx704xg= X-Google-Smtp-Source: ABdhPJz9j21CbK4GXMKRa3zIjwwyVrUSyzugea+YzpkLKJKY8sZUoZMAUum6Fx2qQJUhyGn/qt3MiPhPTuIG9wa08UI= X-Received: by 2002:a17:902:ebca:b0:15f:4cc5:f40f with SMTP id p10-20020a170902ebca00b0015f4cc5f40fmr64541183plg.96.1654077663929; Wed, 01 Jun 2022 03:01:03 -0700 (PDT) MIME-Version: 1.0 References: <20220601115026.452a6840@vepi2> In-Reply-To: From: Arjen Markus Date: Wed, 1 Jun 2022 12:00:52 +0200 Message-ID: Subject: Re: is there a way to find out gfortran version and/or options from a given binary? To: Andre Vehreschild Cc: Kay Diederichs , Fortran List X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, 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 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: Wed, 01 Jun 2022 10:01:21 -0000 Well, if you call these functions in the code, the text is available in the executable file. I used: ! staticv.f90 -- ! Static information about the compiler? Not via parameters ! program staticv use iso_fortran_env implicit none character(len=200) :: c, d c = compiler_version() d = compiler_options() write(*,*) c(1:1), d(1:)1 end program staticv to force the text strings to appear. I think a long character string is required. Regards, Arjen Op wo 1 jun. 2022 om 11:53 schreef Arjen Markus : > I thought you might get this information by using these two functions in a > parameter definition, but that is not allowed, alas. > > Regards, > > Arjen > > > Op wo 1 jun. 2022 om 11:50 schreef Andre Vehreschild via Fortran < > fortran@gcc.gnu.org>: > >> Hi Kay, >> >> did you try: >> >> $ strings coarray_collectives_18 | grep GNU >> GCC: (GNU) 11.2.1 20211203 (Red Hat 11.2.1-7) >> GCC: (GNU) 12.0.1 20220214 (experimental) >> GNU Fortran2008 12.0.1 20220214 (experimental) -mtune=generic >> -march=x86-64 -g >> -fcoarray=lib -fintrinsic-modules-path >> >> /home/vehre/Projekte/gcc/gfortran/lib/gcc/x86_64-pc-linux-gnu/12.0.1/finclude >> -fpre-include=/usr/include/finclude/math-vector-fortran.h GNU C11 12.0.1 >> 20220214 (experimental) -mshstk -mtune=generic -march=x86-64 -g -O2 -O0 >> -std=gnu11 -fcf-protection=full -fcx-fortran-rules -ffunction-sections >> -fdata-sections __GNU_EH_FRAME_HDR >> >> or >> >> strings coarray_collectives_18 | grep GCC >> >> ... >> ? >> >> Both give me some output (albeit more than I desire) for an executable >> compiled >> with gfortran. But presumably, I had activated debug. I don't know, if >> optimized builds will have it, too. >> >> Regards, >> Andre >> >> On Wed, 1 Jun 2022 11:41:41 +0200 >> Kay Diederichs wrote: >> >> > Hi Arjen, >> > >> > thanks for your answer. I do know about these functions, and use them >> in my >> > own programs if appropriate. However, programs distributed to others for >> > production use should not output this because it confuses users (as does >> > "Note: The following floating-point exceptions are signalling: >> > IEEE_INVALID_FLAG" which I need to switch off with -ffpe-summary=none). >> > >> > So I really am looking for strings or other type of info in the binary. >> > >> > Best wishes, >> > Kay >> > >> > On 6/1/22 11:30, Arjen Markus wrote: >> > > Are you perhaps looking for the compiler_version() and >> compiler_options() >> > > functions? I use them like this, they were defined in Fortran 2008 if >> I am >> > > not mistaken: >> > > >> > > >> > > WRITE( lurep, '(a)' ) 'Report of simulation' >> > > WRITE( lurep, '(a)' ) '--------------------' >> > > WRITE( lurep, '(a)' ) 'Compiler version: ', >> > > compiler_version() WRITE( lurep, '(a)' ) 'Compiler options: ', >> > > compiler_options() >> > > >> > > Regards, >> > > >> > > Arjen >> > > >> > > Op wo 1 jun. 2022 om 10:42 schreef Kay Diederichs >> > > > kay.diederichs@uni-konstanz.de>>: >> > > >> > > Hi, >> > > >> > > is there any gfortran option and/or version information available >> > > from/in a binary? Maybe accessible with objdump or strings? >> > > >> > > For ifort, we use the -sox option ("This option tells the >> compiler to >> > > save the compilation options and version number in the executable >> file. >> > > ..."). This enables e.g. strings /path/to/binary | grep Intel >> > > >> > > Or is there a gfortran option that makes this accessible in a >> binary? >> > > >> > > Thanks, >> > > Kay >> > > >> > > >> > >> >> >> -- >> Andre Vehreschild * Email: vehre ad gmx dot de >> >