compiler info in kernel identification string
Dimitry Andric
dim at FreeBSD.org
Thu Nov 15 23:05:40 UTC 2012
On 2012-11-15 21:43, Andriy Gapon wrote:> on 14/11/2012 01:43 Mateusz Guzik said the following:
>> Hello,
>>
>> 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
>
> When are you committing this?
Please don't commit it yet, we're not done reviewing. :)
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}.
Then, if you fix the script use ${CC}, and set it to gcc versions from
ports (for example), the parsing breaks down, as I expected:
$ echo $CC
/usr/local/bin/gcc47
$ compiler="gcc-"`$CC --version | head -n1 | awk '{ print $3 "-" $4}'`
$ echo $compiler
gcc-Ports-Collection)
So please fix this first. Either handle all possible variants of
version output, or just put the version string verbatim into the
identification. I would opt for the latter.
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.
More information about the freebsd-current
mailing list