Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Nov 2012 10:42:18 +0100
From:      Dimitry Andric <dim@FreeBSD.org>
To:        Daniel Braniss <danny@cs.huji.ac.il>
Cc:        Mateusz Guzik <mjguzik@gmail.com>, avg@freebsd.org, freebsd-current@freebsd.org
Subject:   Re: compiler info in kernel identification string
Message-ID:  <50A3677A.2030200@FreeBSD.org>
In-Reply-To: <E1TYWyx-0003b5-CF@kabab.cs.huji.ac.il>
References:  <20121113234303.GA15319@dft-labs.eu> <E1TYWyx-0003b5-CF@kabab.cs.huji.ac.il>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2012-11-14 08:01, Daniel Braniss wrote:
> in the old days (I'm talking before C :-) I remmeber one compiler
> putting such info in the code it produced, I wonder if that's the case
> with gcc/clang, and if so it would be nice if file(1) could show it.
> my 3c,

As far as I know, gcc has always included such information:

   $ touch empty.c
   $ gcc -c empty.c
   $ objdump -j .comment -s empty.o

   empty.o:     file format elf32-i386-freebsd

   Contents of section .comment:
    0000 00474343 3a202847 4e552920 342e322e  .GCC: (GNU) 4.2.
    0010 31203230 30373038 33312070 61746368  1 20070831 patch
    0020 6564205b 46726565 4253445d 00        ed [FreeBSD].
   $ gcc47 -c empty.c
   $ objdump -j .comment -s empty.o

   empty.o:     file format elf32-i386-freebsd

   Contents of section .comment:
    0000 00474343 3a202846 72656542 53442050  .GCC: (FreeBSD P
    0010 6f727473 20436f6c 6c656374 696f6e29  orts Collection)
    0020 20342e37 2e332032 30313230 39323920   4.7.3 20120929
    0030 28707265 72656c65 61736529 00        (prerelease).

There is an old LLVM PR to get the same supported for clang, but it
ended up at the bottom of the pile:

   http://llvm.org/bugs/show_bug.cgi?id=7292

I should probably just make a patch for it, and submit it. :-)



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