compiler info in kernel identification string

Mateusz Guzik mjguzik at gmail.com
Thu Nov 15 23:35:28 UTC 2012


On Fri, Nov 16, 2012 at 12:05:33AM +0100, Dimitry Andric wrote:
> For starters, this hardcodes the compiler names "gcc" and "clang", and
> this will include incorrect information into the kernel version string,
> if you use another setting for ${CC}.
> 

Yes, I blindly assumed that both gcc and clang will keep format of --version.
For everything else you would get 'unknown-compiler'.

> 
> Last but not least, I am not sure this information belongs in uname at
> all.  Maybe it would be better to put it somewhere else, in a sysctl, or
> show it in dmesg.

As stated in original mail, I don't have strong opinions on this. I only
care about accessibility of this information.

So, here is my patch that adds information at boot time and sysctl
kern.compiler:

http://people.freebsd.org/~mjg/patches/compiler-info.diff

Sample output:
Copyright (c) 1992-2012 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 10.0-CURRENT #281 r243095=c24a389-dirty: Fri Nov 16 00:24:46 CET 2012
f at lap:/usr/obj/i386.i386/srv/repos/freebsd/sys/DEVEL i386
Compiled with cc (GCC) 4.2.1 20070831 patched [FreeBSD] <------ HERE
WARNING: WITNESS option enabled, expect reduced performance.
WARNING: DIAGNOSTIC option enabled, expect reduced performance.
CPU: Intel(R) Core(TM)2 Duo CPU     P9600 @ 2.66GHz (2635.19-MHz 686-class CPU)
[..]

As you can see only first line is captured and I go with assumption that
--version works, I hope this is ok.

-- 
Mateusz Guzik <mjguzik gmail.com>


More information about the freebsd-current mailing list