Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Nov 2012 10:25:48 +0100
From:      Dimitry Andric <dim@FreeBSD.org>
To:        Mateusz Guzik <mjguzik@gmail.com>, freebsd-current@freebsd.org,  avg@freebsd.org
Subject:   Re: compiler info in kernel identification string
Message-ID:  <50A3639C.9050200@FreeBSD.org>
In-Reply-To: <20121113234303.GA15319@dft-labs.eu>
References:  <20121113234303.GA15319@dft-labs.eu>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2012-11-14 00:43, Mateusz Guzik wrote:
> avg@ suggested to include compiler version in the kernel so that it's
> present in uname (and one can easly tell what was used to compile it).
>
> Here is my attempt:
> http://people.freebsd.org/~mjg/patches/newvers-compiler.diff
>
> Basically adds compiler name and version/revision after revision of
> system sources.
>
> Sample output from dirty git sources:
> gcc:
> FreeBSD 10.0-CURRENT #7 r242962=264d569-dirty(gcc-4.2.1-20070831): Wed
> Nov 14 00:11:51 CET 2012
>
> clang:
> FreeBSD 10.0-CURRENT #8 r242962=264d569-dirty(clang-r162107): Wed Nov 14
> 00:12:26 CET 2012
>
> Sample output from svn with gcc:
> FreeBSD 10.0-CURRENT #1 r243006:243007M(gcc-4.2.1-20070831): Wed Nov 14
> 00:41:23 CET 2012
>
> I have no strong opinions on format, I just want this information easly
> accessible.

Yes, this is handy to have.  Note that gcc already puts an id string
into each object file it produces, but sometimes during linking, these
can be stripped out...

Regarding the format, I don't see the necessity of parsing the version
information, which will always be very fragile.  Just include the
complete version string in the compiler identification, similar to what
Linux does, e.g. on a CentOS box:

   $ gcc -v 2>&1 | grep 'version '
   gcc version 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC)

   $ dmesg | grep 'gcc version '
   Linux version 2.6.32-279.2.1.el6.x86_64 (mockbuild@c6b7.bsys.dev.centos.org) (gcc version 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC) ) #1 SMP Fri Jul 20 01:55:29 UTC 2012

That way, you are sure never to lose information.  This also works for
gcc from ports (which is the reason for the space after 'version' in the
grep command):

   $ gcc47 -v 2>&1 | grep 'version '
   gcc version 4.7.3 20120929 (prerelease) (FreeBSD Ports Collection)

I realize this is a bit long, but it is better to have complete than
stripped information.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?50A3639C.9050200>