From owner-freebsd-current@FreeBSD.ORG Sun Dec 23 13:18:19 2012 Return-Path: Delivered-To: freebsd-current@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9A5F76A3 for ; Sun, 23 Dec 2012 13:18:19 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id E09348FC14 for ; Sun, 23 Dec 2012 13:18:18 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id PAA24338; Sun, 23 Dec 2012 15:18:15 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1TmlRX-000Fct-CY; Sun, 23 Dec 2012 15:18:15 +0200 Message-ID: <50D70496.6030307@FreeBSD.org> Date: Sun, 23 Dec 2012 15:18:14 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Mateusz Guzik , freebsd-current@FreeBSD.org Subject: Re: compiler info in kernel identification string References: <20121113234303.GA15319@dft-labs.eu> <50A5540D.2030707@FreeBSD.org> In-Reply-To: <50A5540D.2030707@FreeBSD.org> X-Enigmail-Version: 1.4.6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Dec 2012 13:18:19 -0000 on 15/11/2012 22:43 Andriy Gapon said the following: > 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? It seems that this effort has stuck?.. Here is a change that I am using locally. It doesn't change uname output at all, but rather adds a compiler version string to the kernel banner. I may even commit this :) [test] print compiler version in the kernel banner diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index 5e83e1a..724f609 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -86,6 +86,7 @@ fi touch version v=`cat version` u=${USER:-root} d=`pwd` h=${HOSTNAME:-`hostname`} t=`date` i=`${MAKE:-make} -V KERN_IDENT` +compiler_v=$($(${MAKE:-make} -V CC) -v 2>&1 | grep 'version') for dir in /bin /usr/bin /usr/local/bin; do if [ -x "${dir}/svnversion" ] && [ -z ${svnversion} ] ; then @@ -159,6 +160,7 @@ $COPYRIGHT char sccs[sizeof(SCCSSTR) > 128 ? sizeof(SCCSSTR) : 128] = SCCSSTR; char version[sizeof(VERSTR) > 256 ? sizeof(VERSTR) : 256] = VERSTR; +char compiler_version[] = "${compiler_v}"; char ostype[] = "${TYPE}"; char osrelease[sizeof(RELSTR) > 32 ? sizeof(RELSTR) : 32] = RELSTR; int osreldate = ${RELDATE}; diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index 00b1c3f..a92b6db 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -325,6 +325,7 @@ print_version(void *data __unused) while (len > 0 && version[len - 1] == '\n') len--; printf("%.*s %s\n", len, version, machine); + printf("%s\n", compiler_version); } SYSINIT(announce, SI_SUB_COPYRIGHT, SI_ORDER_FIRST, print_caddr_t, diff --git a/sys/sys/systm.h b/sys/sys/systm.h index fec77d2..3163b9f 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -49,6 +49,7 @@ extern int cold; /* nonzero if we are doing a cold boot */ extern int rebooting; /* kern_reboot() has been called. */ extern const char *panicstr; /* panic message */ extern char version[]; /* system version */ +extern char compiler_version[]; /* system version */ extern char copyright[]; /* system copyright */ extern int kstack_pages; /* number of kernel stack pages */ -- Andriy Gapon